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

SELECT STATEMENT FROM TABLE(SYS_BOOT.MGMT.GENERATE_DDL_FOR_TABLE('SALES','BIDS_VIEW'));
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)'
');'

You can also invoke this function for a view:

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;'