GENERATE_DDL_FOR_TABLE

Generates DDL for everything in current table or view

Syntax

You can implement this function using the following code:

SELECT STATEMENT FROM
TABLE(SYS_BOOT.MGMT.GENERATE_DDL_FOR_TABLE(SYS_BOOT.MGMT.GENERATE_DDL_FOR_TABLE(schema_name,table_name));

where schema_name is the name of the current schema and table_name is the name of the table or view for which you want to generate DDL.

or

SELECT STATEMENT FROM
TABLE(SYS_BOOT.MGMT.GENERATE_DDL_FOR_TABLE(<schema_name>,<view_name>));

Example

0: jdbc:sqlstream:sdp://drew-VirtualBox> SELECT STATEMENT FROM TABLE(SYS_BOOT.MGMT.GENERATE_DDL_FOR_TABLE('SALES', 'BIDS'));
'STATEMENT'
'CREATE OR REPLACE STREAM SALES.BIDS ('
'   "time" BIGINT,'
'   "ticker" VARCHAR(5),'
'   "shares" INTEGER,'
'   "price" REAL,'
'   "expiryMs" BIGINT,'
'   "comment" VARCHAR(1024)'
');'
8 rows selected (0.56 seconds)

You can also invoke this function for a view:

0: jdbc:sqlstream:sdp://drew-VirtualBox> SELECT STATEMENT FROM TABLE(SYS_BOOT.MGMT.GENERATE_DDL_FOR_TABLE('SALES', 'TEMPSVIEW'));
'STATEMENT'
'SET SCHEMA 'SALES';'
'CREATE OR REPLACE VIEW SALES.TEMPSVIEW AS'
'select empno, name from temps;'
3 rows selected (0.279 seconds)