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,247
questions
0
votes
1
answer
35
views
how is CHAR type stored if BLANK_TRIMMING parameter is set TRUE? (Oracle)
I wonder how is CHAR type column data stored if the initialization parameter 'BLACK_TRIMMING' is set TRUE.
Is it right that all blanks are trimmed and stored up to the last non-blank character?
ex)
-- ...
0
votes
1
answer
19
views
Oracle error when trying to create a trigger
I am new to databases and I know this is a simple question but I cannot find an answer anywhere, so I appreciate the help.
I have 2 tables, each with the same structure.
Table1
CaseNum Number(9,0)
...
0
votes
0
answers
17
views
how can I exclude ddl excution in liquibase
I have a problem, I need exclude ddl execution in liquibase but I do not how I can do.
I did to laboratory in maven with java but it dones't work in this case with is liquibase normal therefore I ...
0
votes
1
answer
37
views
Apache Ignite .Net : KeyNotFoundException occurs when using multi-PK
I use gridgain Ignite community 8.8.31(it is same at apache ignite 2.15), and I made two tables using DDL.(Insert data with DML)
When I try to cache.get() using C#/.NET, Person3 has error but Person4 ...
0
votes
1
answer
52
views
How can I run multiple DDL statements from a recordset loop?
Hopefully an easy one- for obvious reasons, I would like to rename several thousand field names to remove spaces and special characters across hundreds of tables. I put all the edits into a simple ...
0
votes
0
answers
60
views
Access Violation when building a dynamic library using FMX for MacOS platform
I have recently read from a eBook named "Fearless Cross-Platform Development with Delphi" about developing a cross-platform dynamic library application. Therefore, I downloaded the sample ...
0
votes
1
answer
38
views
How to handle datetimeoffset(7) datatype in snowflake?
I have a DDL that has LastUpdatedTime with datatype datetimeoffset(7) in sql server. what's the equivalent datatype in snowflake or how to handle this to get exact value that is in source.
I tried ...
0
votes
0
answers
36
views
Postgres 14 - DDL and DML users
I need to create 2 users for a database and schema, one for DDL queries and the other for DML queries. Is it possible and how can i do it?
I'm running Postgres 14 on windows and pgAdmin to run queries
...
-3
votes
2
answers
89
views
How do I design a trigger for Postgresql, and what is wrong with my "Hello world" test?
I need to use triggers in postgresql (preferably via SQLALchemy ORM). However, I can't seem to get to first base with creating one.
As a basic test, I am trying to put the string "Hello world&...
0
votes
1
answer
88
views
GET_DDL function in snowflake doesn't work properly for streams
I faced out with following issue during using GET_DLL function in Snowflake:
I expect to see a fully-qualified names (schema_name + object_name at least) for tables which I use in stream definitions. ...
1
vote
2
answers
203
views
MySQL 8 ALGORITHM=INSTANT taking a long time
I just ran the following ALTER TABLE statement with ALGORITHM=INSTANT on Percona Server for MySQL 8.0.33-25 and the statement took over 100 seconds to run: ALTER TABLE documents ADD COLUMN test ...
1
vote
4
answers
51
views
MySQL Drop Index's with loop?
I have a database with a lot of unscary indexes. I don't want to remove them all with one big query for time reasons. I'm not very familiar with query languages so is there a way to loop through the ...
0
votes
2
answers
38
views
CREATE TABLE fails in combination WITH keyword
(WITH
occupational as (
select
...
from census
),
result as (
select
...
FROM `folder.dashboard.target_table`
LEFT JOIN occupational
USING (keys)
)
CREATE ...
0
votes
1
answer
33
views
Adding unique constraint for self-referencing association table in PostgreSQL
SQLFiddle
I have a table of ingredients and a self-referencing association table that links ingredients to each other.
I want to add a constraint that ensures each association between 2 ingredients ...
0
votes
1
answer
42
views
Missing default value of varchar2(4000) column in DBMS_METADATA.GET_DDL (oracle 11g)
step 1 - create a table like this:
CREATE TABLE "TEST1"."JWTEST"
(
C0 NUMBER(38) not null PRIMARY KEY,
C1 VARCHAR2(4000) DEFAULT 'abcd...(total 4000 characters)...abcd',
...
1
vote
1
answer
56
views
What are the ways to modify or hack the jOOQ-generated DDL?
I am using the schema exporting feature of jOOQ extensively. Unfortunately, in some cases, jOOQ generates incorrect or inaccurate DDL for database objects. Are there any standard ways to slightly ...
0
votes
1
answer
130
views
DB2 ADD a new COLUMN to a table with DEFAULT value from an EXPRESSION using existing data in another column
ALTER TABLE my_table ADD COLUMN new_column_name data_type DEFAULT expression;
Is it possible to use an existing column data as default value for a new column in DB2?
ALTER TABLE employees ADD COLUMN ...
1
vote
1
answer
207
views
How to create a table from remote database using dblink
How to create a table from remote database using dblink
create table MYTABLE@DBLINK (name varchar2(20)));
*Cause: An attempt was made to use a DDL operation on a remote database.
For example, &...
0
votes
0
answers
35
views
UnsupportedOperationException: CteInsertStrategy can only be used with Dialects that support CTE that can take UPDATE or DELETE statements as well
I would like to generate ddl using my entities.
Please note I'm using latest springboot 3.0.6
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven....
0
votes
0
answers
19
views
When exactly does Hibernate create tables according to @Entity mappings?
I have a test class that fetches a JWT token in its constructor. Or rather, it tries to: the tables are not yet created by the time constructor code is executed so all test methods fail with a 401 ...
0
votes
1
answer
24
views
How to create a primary key using sqlalchemy of type 'generated always as identity'
I'm using postgres, and want to create the SQLA model for the following DDL:
create table tbl(
tbl_id INT generated always as identity PRIMARY KEY,
tbl_x INT
)
How to create this table ...
0
votes
1
answer
37
views
DDL Hive SQL for raw data wrapped in []
DDL Hive SQL for raw data wrapped in []
Hello,
So i have a .txt data consist of 1000 rows data with below format:
[a, "b", c, d, "e", f, "123, 4567, 89101, 2345"]
I want ...
1
vote
1
answer
35
views
CREATE FUNCTION statement in an IF block throws error, while running on its own works
I'm new to PostgreSQL (currently on PostgreSQL 13) and may be confusing things from what other SQL encounters I've had (Microsoft SQL).
The goal is to assert there are no values in a table column ...
0
votes
1
answer
122
views
See version history of a view definition in BigQuery
Within BigQuery, is there a way to see previous versions of the DDL definition of a view? I want to understand when a view was changed and what the changes were. Basically like a Git diff.
0
votes
1
answer
88
views
Oracle Get DDL without extra details and sort - to use for version control
I'm trying to get the DDL for tables, views, indexes, sequences and so on in order to use for version control, and do comparisons between different db's which should have identical tables (i.e. dev vs ...
0
votes
0
answers
8
views
How can I get user creation code using DBMS_METADATA? [duplicate]
I need to get a DDL script of a partucular user.
I'm trying to use the DBMS_METADATA.GET_DDL('USER', user) to get a ddl of current user, but I get an error: "object "user1" of type USER ...
0
votes
1
answer
46
views
How is the Definer Rights program unit obtaining ALTER SESSION Privilege?
The following is an excerpt from the Oracle 19c Database PL/SQL Language Reference documentation PL/SQL Subprograms 8.14 (emphasis added).
"During a server call, when a DR [DEFINER RIGHT] unit ...
1
vote
1
answer
150
views
SNOWFLAKE - How to bind variables with DDL inside a procedure?
I've used binding variables on statement like INSERT or SELECT with the '?' or ':1' placeholders, but I cannot use it with instructions like CREATE ROLE because it throws an exception.
I need to bind ...
0
votes
0
answers
89
views
List of SET/MULTISET tables in Teradata
I need to figure out below question:
List of all SET and MULTISET tables
List of all SET and MULTISET tables:
There is no inforamtion available in Teradata DBC tables where this information is ...
0
votes
1
answer
110
views
Create partitioned table using sub-query
I want to create a unlogged table based on the result of another query something like
Create table table_1
as
select * from table_2
where <<conditions>>
partition by LIST(col);
Obviously ...
-2
votes
2
answers
42
views
Regex in python to get certain PLSQL statement
i have this code and need a regex to get the code from pl sql to get the lines with the constraint and check
CREATE TABLE
"OWB_RUN"."WITHOUT_RESCHEDULING_OFFER"
( "...
2
votes
2
answers
341
views
Is there anything one cannot do (and then rollback safely) in transaction?
Is there anything one cannot do (and then rollback safely) in transaction?
My transaction is a simple test of a major, disruptive change in a production database. The SQL code wrapped in a transaction ...
0
votes
0
answers
25
views
How to drop a partition and create three partitions of this partition?
there is a partition named "order2". i want to drop this partition and create three patitions of it (so a partition of partitions) using “shipcountry”("shipcountry" is a column in &...
0
votes
1
answer
73
views
Can't create TIMESTAMP WITH TIMEZONE column in postgres due to SyntaxError
I would like to create a table in postgres by running a DDL query using python, however I get a Syntax Error.
My code:
query = """CREATE TABLE data
(
fire_date_utc TIMESTAMP,
...
-1
votes
1
answer
136
views
Is it possible to generate DDL from existing database table with Java? [closed]
My expectation is to generate DDL string from existing tables. Like most of the IDE's do with one click, but via Java. I am using PostgreSQL as database.
What I want to gather is simply this;
From ...
0
votes
0
answers
61
views
How to copy 100+ tables with identity columns from one Teradata database to another?
For a project I have to copy 100+ tables from one database to another. I attempted to do this by writing a cursor that excecutes:
create table {DataBaseName.TableName} as {Existing DataBaseName....
0
votes
1
answer
862
views
Generate DDL of a table through a statement in DBeaver
I'm looking for a way to generate the DDL of a table in DBeaver, I'm using Db2 for IBM as database, through a statement. Is it possible?
0
votes
1
answer
36
views
how to convert a sql expression into sequelize
Can someone convert it to sequelize
CREATE TABLE "fundraiserUpdates" (
"updateId" SERIAL,
"updateFundraiserId" INTEGER NOT NULL,
"updateTitle" TEXT ...
0
votes
1
answer
183
views
How to get a script of existing table in snowflake?
I have an existing table in Snowflake. I need to get a script how this table was created.
I tried get_ddl('Table', 'way to a table') function. But this function helps me to get only the structure of a ...
0
votes
0
answers
221
views
Get DDL for multiple tables in Teradata
For a project, I'm trying to extract the DDL statements for all tables in a Teradata database. The goal is to create a backup of the table DDL. This allows us to audit, restore and/or migrate the ...
0
votes
0
answers
97
views
How to modify/alter the order of columns in a table in postrgesql? And if it isn't possible why? [duplicate]
I have a table with some columns and I would like to change the order of the columns akin to the following example
SomeTable
columnId, column1, column2, column3 etc...
I have tried the following ...
-2
votes
1
answer
54
views
How to alter the same table on 2 SQL Servers with DDL trigger
I have createed an archive SQL database for some tables.
I have one production server and one archive server (the archived database only has a few tables that I archived).
Now I'm searching for an ...
0
votes
0
answers
168
views
Python Parse Oracle DDL and Generate JSON Data
I have a requirement where i need to parse a DDL from Oracle table and generate a JSON data out of it. For that i had used DDL parser in Python to convert it to string however i couldnt able to get it ...
-2
votes
1
answer
84
views
MySQL, adding a new column to an already existing table, involves joins also
Q. Create a new column DaysTakenForDelivery that contains the date difference between Order_Date and Ship_Date.
Tables available are: orders and shipping
CREATE TABLE orders (
Order_ID int DEFAULT ...
0
votes
0
answers
15
views
Going from erd relation to table
I need to convert an erd to a set of DDL statements, which then represent the erd. I am stuck on how I translate relations to DDL statements. Say we have entity department, with primary key name, and ...
0
votes
0
answers
92
views
How to parameterize snowflake account queries
I'd like to paramaterize accountName in create_account_query. I can't get the query to insert the account name. Any ideas?
Running the following
Traceback (most recent call last):
File "test.py&...
0
votes
2
answers
58
views
How to rename existing table in the data base using Kotlin Exposed framework?
I can't find any information on how to rename an existing table in a database using Kotlin Exposed framework? If possible, please give me any explanation. Thank you in advance.
I read all official ...
0
votes
0
answers
166
views
How can I import a pyd file in spyder from anaconda?
I'm using spyder from Anaconda. I'm trying to import a pyd file but this message appeared: 'DLL load failed while importing _py_bbt_driver: No se puede encontrar el módulo especificado.'. How can I ...
0
votes
1
answer
160
views
How to change data type in PostgresSQL on Amazon Redshift?
I am trying to change data types from varchar to bigint on Amazon Redshift without any luck.
I have tried several syntaxes but none of them seem to work and internet is always an enormous resource of ...
0
votes
0
answers
88
views
when using dbms_metadata.get_ddl to generate the ddl for a table can I exclude creating of constraints
I am trying to develop some scripts so I can recreate the oracle schema for a development user when I need to refresh the data from a MySQL production database.
I am using the dbms_metadata.get_ddl ...