Get DDL for a view or table

Posted: July 12, 2012 in Objects

How to generate the DLL for a table or a view from sqlplus, useful if you’ve not got a GUI tool.

So as the schema owner connect and run the following, in this example the table is called TEST_TABLE

set long 1000

select DBMS_METADATA.GET_DDL(‘TABLE’,’TEST_TABLE’) from dual;

output

 

view example

set long 1000

select DBMS_METADATA.GET_DDL(‘VIEW’,’TEST_VIEW’)from dual;

output

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s