Monday, July 18

Extracting Oracle object DDL

It is often usefull to be able to get the DDL for existing schema objects, one easy method is to do an export of the schema in question and import it to an indexfile and the other method is to use the dbms_metadata package, the later method is probably faster and the preferred way.

Example how to get scott.emp DDL
set heading off
set pages 0
set long 1000

select
dbms_metadata.get_ddl('TABLE','EMP','SCOTT')
from
dual
/
I wrote a small script to export a full schema, just connect as the schema owner and run the script. [ View ].

Read Using DBMS_METADATA documentation.

No comments: