When you create do a CTAS (create table as select) of a table you only get the structure, but lose the index, PK, FK, etc.
Example:
create table t1 select * from table2;
How can a copy of the table structure be made that includes these things without doing a backup?
Best Answer
TABLE
is the type of object (you can also extractINDEX
,VIEW
,FUNCTION
,PROCEDURE
etc)or:
dbms_metadata.get_ddl
is the way to go, as it preserves various aspects that a CTAS query doesn't.