Thursday, August 14, 2008

Oracle: How to retrieve DDL of any object

Select dbms_metadata.get_ddl('TABLE','TABLE_NAME') from dual

Some key parameters for get_ddl

object_type - The type of object to be retrieved. ex: TABLE, TABLESPACE,INDEX etc
object_name - Name of the object.
object_schema- Schema containing the object. Defaults to the caller's schema.

ex: Select dbms_metadata.get_ddl ('TABLE','EMPLOYEE','SCOTT') from dual

No comments:

Post a Comment