The easy way to Get table and index DDL script:
The dbms_metadata utility helps to display DDL directly from the data dictionary. We see the small example.
Initial setup:SQL> conn scott/tiger;Connected.SQL> create table GET_TAB_SCRIPT2 (3 c1 varchar2(10),4 c2 number5 );Table created.SQL> insert into get_tab_script values ('A',10);1 row created.SQL> commit;Commit complete.SQL> create index idx_1 on GET_TAB_SCRIPT (c1);Index created.
To get table script:
SQL> select dbms_metadata.get_ddl('TABLE','GET_TAB_SCRIPT') from dual;DBMS_METADATA.GET_DDL('TABLE','GET_TAB_SCRIPT')------------------------------------------------CREATE...