tags:

views:

50

answers:

2

Hi all,

Is it possible to trace back the exact create table statement that was used to create a table ?

Thanks, Trinity.

+7  A: 

Have a look at DBMS_METADATA.GET_DDL. Note this will only retrieve the DDL required to create the table in it's current state, not necessarily the DDL used to create the table initially.

This statement illustrates:

SELECT DBMS_METADATA.GET_DDL('TABLE','<my_tab>') FROM dual;
DCookie
Cool ! Exactly what i wanted, Thanks :)
trinity
Also see http://stackoverflow.com/questions/3138619/how-do-i-get-an-oracle-schema-as-ddl-scripts-with-dbms-metadata-and-schema-expor for the problem with foreign key constraints (in case you have any) when using this approach.
bunting
@bunting, thanks for that reference.
DCookie
+1  A: 

You could download an application like Oracle SQL Developer. Then go to the table, and click on the "SQL" tab and it will generate the create statements, with PCTFREE and TABLESPACE and all the goodness!

Jacob Nelson