Questions tagged [ddl]
Data Definition Language is a subset of SQL to manipulate structural elements of a database, not the content of tables. CREATE, DROP, ALTER and related statements.
2,151
questions
1
vote
1
answer
29
views
Oracle sqldeveloper Export data is lack when I get mass of metadata
Data lack is happen when I execute following query and export tsv from wizard.
--query
Select
view_name
, replace(replace(dbms_metadata.get_ddl(‘VIEW’, view_name), ‘“‘,’’), concat(user, ‘.’),’’) as ...
-2
votes
0
answers
27
views
Problem with finding good database schema design
I'm designing a relational database schema for a B2B:
I have two tables: Product and Supplier (which supplies the products).
Each supplier sends me a csv file which is a Product table with different ...
0
votes
1
answer
17
views
JPA/Hibernate - how to generate ddl for some classes but not others
Is it possible to turn off DDL generation on the class level vs the full application?
I have a reporting app that we have thus far had the setting in application.properties
jpa.generateDdl=false
We ...
0
votes
0
answers
29
views
psql transaction block vs anonymous code block
what is the best way to rename a column if exists inside a pl/sql script using psql.exe and without rolling back the whole script:
transaction block (begin/commit)
begin;
alter table table1 rename ...
0
votes
1
answer
40
views
For loop in Bigquery
The following SQL in Bigquery:
FOR tableId IN (
select table_id
from `misys-db-replication-nutracap.hevo_dataset_misys_db_replication_nutracap_LPj9.__TABLES__`
WHERE NOT STARTS_WITH(table_id, &...
0
votes
0
answers
32
views
Why can't I change primary key in postgresql?
When I migrate the Django project model, I get the error:
there is no unique constraint matching given keys for referenced table "accounts_account
my models is:
class Account(AbstractBaseUser):
...
0
votes
0
answers
22
views
Unable to update foreign key column of parent table from child table?
I have two below table orders and cart -
CREATE TABLE order_details (
order_id INT PRIMARY KEY,
cust_id INT NOT NULL,
cart_id INT,
payment_id INT NOT NULL,
payment_date DATE,
order_date DATE NOT NULL,
...
0
votes
1
answer
32
views
How can I run a DDL script over and over without error
I need to create a DDL script for school and have it be able to run over and over. To run over and over, I need to drop everything and then run the scripts to recreate and populate my tables, ...
0
votes
1
answer
28
views
dropping a partioned table in postgres
I am trying to understand the behavior of Postgres partitions.
I have a partitioned table and I am trying to know what would be the behaviour if I
Drop table
Rename Table
Rename Index
If I do a
DROP ...
-2
votes
0
answers
21
views
Postgres DDL Query Generation from Json object
Hi All I am trying to Generate a DDL Code from json object I am getting from an API.
Input is like a definition of table information such as:
"Table name, columns name, data types of columns, ...
1
vote
1
answer
59
views
What minimum permissions requires to execute an undocumented stored procedure called SYSPROC.DB2LK_GENERATE_DDL?
I don't want to execute the stored procedure with admin privileges or with the instance owner. I am looking for the minimum permissions required to execute an undocumented stored procedure called ...
0
votes
0
answers
31
views
How to track the DDL changes in MSsql [duplicate]
I need to create the stored procedure in mssql to track the ddl changes. If any ddl changes occured like new table create, new column added, altered exisitng column, drop column then procedure should ...
-1
votes
0
answers
30
views
SQL create table define key without tell it is a 'primary' or 'unique' or ... , what kind of key will it be?
As said in the title
CREATE TABLE T1
(
column1 type ...,
column2 type ...,
column3 type ...,
...
KEY `key_1` (`column1`),
CONSTRAINT `constraint_1`
FOREIGN KEY (`...`)...
0
votes
0
answers
35
views
Extracting DDL from remote DB2 database instance (DB2 z/OS) in Java
We are able to extract the DDL with help of JCSH to execute DB2Look command but due to security reasons we can't get the full access to the db2 instance in order to execute the DB2Look command ...
-1
votes
1
answer
38
views
ORA-00911: invalid character when creating table
I'm trying to execute this query, but I'm getting ORA-00911: invalid character. It appears as if the error is ASCII characters in front of my table name.
CREATE TABLE #RMDist (
Rebate_ID VarChar(MAX)...
0
votes
2
answers
53
views
DB2- how to prevent user viewing view DDL
i'm having this situation whereby user are using Dbeaver to access to DB2. There is some views created. At the moment user have the ability to use the Dbeaver to see the view DDL (back end code).
...
0
votes
1
answer
44
views
Is it possible to change the name of a parameter in a PostgresQL function?
I have a Postgres function defined as follows:
CREATE OR REPLACE FUNCTION my_test_function(query_since timestamp) RETURNS TABLE () ...
Can I update the name of the parameter, query_since, to ...
0
votes
0
answers
63
views
DB2: Working with concurrent DDL operations
We are working on a data warehouse using IBM DB2 and we wanted to load data by partition exchange. That means we prepare a temporary table with the data we want to load into the target table and then ...
0
votes
1
answer
54
views
In PostgresQL, Is there a sql(not pg_dump) which resemble to "show create table [tablename]" in MySQL? [duplicate]
I want to get "create table clause" by a sql.
Or can I use Knex.js to get "create table clause"?
I've seen this "How to generate the "create table" sql statement for ...
0
votes
0
answers
23
views
Trouble in changing VARCHAR type to timestamp using ALTER in Postgresql
data set screenshot
I have used the code as below to change varying character to datetime, but had problem.
ALTER TABLE updated_runner_orders
ALTER COLUMN pickup_time
TYPE TIMESTAMP
USING ...
0
votes
1
answer
59
views
Rename a table in Amazon Redshift
I've been trying to rename a table from "fund performance" to fund_performance in SQLWorkbench for a Redshift database. Commands I have tried are:
alter table schemaname."fund ...
0
votes
0
answers
23
views
python sqlalchemy trigger function
I have two questions and any help will be much appreciated.
1. I created a trigger function to auto-update the 'updated_at' field if any changes to a row. I got the following output from the Python ...
1
vote
1
answer
62
views
Is there a way for a C# application using a C++ DLL to provide a callback function which takes a String as an argument?
So I am trying to write my first program using P/Invoke to create a wrapper around a c++ library to allow use in a c# application. One of the features of the library is it takes a callback function (...
0
votes
1
answer
32
views
Transient annotation and error executing DDL
I use the annotation @ trasient to declare a boolean variable but when I start my spring application, I got the error as below
Error executing DDL "
alter table categories
add column ...
0
votes
0
answers
12
views
Using hibernate to create database table programmaticaly, vendor agnostic DDL
Trying to create a simple table with Primary key database agnostic way. is it possible with hibernate to do it programmatically at runtime?
at runtime i have the filed types + PK field names for the ...
0
votes
0
answers
115
views
ImportError: DLL load failed while importing _gdal: The specified procedure was not found
I am trying to install GDAL and I always get this error message: ImportError:
DLL load failed while importing _gdal: The specified procedure was not found.
I have the Python 3.8.10 (tags/v3.8.10:...
0
votes
2
answers
32
views
Create ExpiryDate during table definition in Oracle
I'm trying to create a table named MEMBER. The datatype for REGISTERDATE is DATE and the default value is SYSDATE. There is another column named EXPIRYDATE, datatype is DATE and the default value is 1 ...
0
votes
1
answer
111
views
Unable to remove index in SQL Server
When the user activates the FK index removal option, DDL is generated for it, and when the PK index removal option is activated, the DDL is created for this application.
Two tables were created with ...
0
votes
0
answers
64
views
Deadlock detected on Alter table add column is postgresql
I am trying to add a column through Hasura cloud.
Running the SQL
alter table "public"."clinic_rosters" add column "with_user_id" uuid null default '';
But it is giving
...
0
votes
1
answer
107
views
How to trim a column value if it exceeds length - varchar -redshift in DDL while creating table
String exceeds ddl length error :
I want to create a table in redshift with ddl that specifies to trim if it exceeds more than characters mentioned. Is there a way ?
I tried insert into with ‘Cast ‘ ...
0
votes
1
answer
38
views
foreign key camel case issue in postgres on heroku server
i am creating table on heroku successfully but the problems is foreign key when add foreign key it will automatically created in small letter by default
postgres accept foreign key like serviceId ...
0
votes
0
answers
16
views
DDL for array<array<String>> column in Hive
I have to store array of array data that looks like this: [['aa','bb','cc'],['dd','ee','ff']]
Here's the Hive DDL I'm using:
create external table <schema>.<table_name>
(
`col1` ARRAY<...
0
votes
0
answers
28
views
Getting SemanticException [Error 10043]: Either list of columns or a custom serializer should be specified with a DDL statement
While running a HiveQL script that I am getting the following error:
SemanticException [Error 10043]: Either list of columns or a custom serializer should be specified
The DDL for the table is as ...
0
votes
1
answer
184
views
How to exclude a column when creating BigQuery external table?
I'm trying to create an external table in BQ using data stored in GCS bucket. Below is the DDL command I'm using:
CREATE OR REPLACE EXTERNAL TABLE `external table`
OPTIONS (
format = 'parquet',
...
0
votes
3
answers
61
views
How to add '/' at the end of each DDl using dbms_metadata(SQL terminator )
In the documentation for dbms_metadata, mentioned about SQLTERMINATOR:
If TRUE, append a SQL terminator (; or /) to each DDL statement. Defaults to FALSE.
by this below step:
BEGIN
DBMS_METADATA....
0
votes
0
answers
194
views
How to generate CREATE TABLE from Kotlin data class
In Kotlin, I'd like to generate a Postgres CREATE TABLE from my data class. For instance, if we have the following:
data class Thing(name: String, quantity: Int, bestBefore: LocalDate)
I'd like to get ...
0
votes
1
answer
20
views
Hibernate : functionnally calling hibernate to recreate constraints
I have been deferring my hibernate DDL usage time after time, from create-drop, to update and now i'm using other tools for database migration, and, while still respecting my hibernate entities, i am ...
0
votes
1
answer
54
views
How to log 'truncate' statement for postgresql?
I would like to log when a table is truncated. I already utilized the event triggers pg_event_trigger_ddl_commands() and pg_event_trigger_dropped_objects() to log ddl activities to my 'ddl_history' ...
0
votes
1
answer
24
views
Dropping tables in a particular schema after X number of days from table creation date
I have a schema specific for temporary tables in redshift. Eventually, as creation of a lot of tables takes a lot of space, I would like to know the following:
Is there a way to automate deletion of ...
0
votes
0
answers
18
views
How to Replicate DDL Changes from Salesforce to Snowflake using IICS
We need to pull data from Salesforce into Snowflake ODS Layer. For this we are using IICS.
As we need to replicate the Salesforce table into snowflake (as it is) we are trying to use the option of &...
1
vote
1
answer
103
views
Is it possible to deactivate index in Firebird without dropping it?
From the ib-aid link at RDB$INDICES System Table the RDB$INDICES has a column RDB$INDEX_INACTIVE column which indicates active/inactive status. Is it possible to modify this column to activate or ...
0
votes
1
answer
89
views
Create DDL statement from JSON file. How to avoid/minimize SQL injection?
I am working on a project which will require the user to enter the UI and create the table name on their own. Inputting table name and columns (column name, type, and other info).
Although it's easy ...
0
votes
0
answers
51
views
Java Sql Builder for DDL operatons with safe from sqlinjections
In my service, I get a table name and a set of columns (with names and types) from api. I want to generate a sql string with which you can create a table in a database (postgres) with the specified ...
0
votes
1
answer
64
views
how to get the output of DDL commands Python cx_oracle
I am currently working with cx_oracle
Here with SELECT statements I am able to use the fetchall() function to get rows.
But how to get the outputs for queries that fall under Data Definition Language (...
0
votes
1
answer
61
views
Changing Entire Column to Date Type in SQL
I am trying to convert the datatype of a column Confirmation_Dateto date type but unable to to do so, the Column is of varchar type and SER_MUHAMMAD_MALLICK.user is the tablel. Iam using the following ...
0
votes
0
answers
152
views
Generating DDL's using DBeaver through CLI
I'm looking for a way to automate the generation of DDL's from my database (Sybase IQ).
I found that DBeaver (Windows) can generate the DDL's and that it also has various CLI parameters to control ...
0
votes
1
answer
35
views
Can DB2 DDL be generated using the IBM.Data.Db2 library
I'm new to Db2 and need to generate DDL for an existing table but don't have access to any tools. Is it possible to do this through the IBM.Data.DB2 library? I can get a datareader but only the ...
0
votes
0
answers
23
views
How to get DDL Binary value?
so I'm creating SQL assemblies and I have problem trusting my DDL.
So to trust my DDL, I need to get it's binary value and covert it using hashbytes.
Example "0x45DA90000036153900000....."
...
1
vote
1
answer
215
views
Can PostgreSQL declare a procedure inside a procedure?
create or replace procedure procedure_1()
language plpgsql
as $$
declare
precedure procedure_2()
begin
select 1;
end
begin
select 1;
end; $$
Is there any way to declare a ...
-3
votes
1
answer
31
views
Constraint: You cannot be a supporter of an NGO if you are below 18 years old [closed]
I have the following tables:
https://i.stack.imgur.com/bGvDW.png
Where can i enter this constraint to check if age is atleast 18? Kind of confusing