Oracle PL/SQL Tutorial/System Packages/dbms metadata
dbms_metadata.get_ddl( "TABLE", "TABLENAME" )
SQL>
SQL> create table t
2 ( x int primary key,
3 y date,
4 z clob
5 )
6 /
Table created.
SQL> select dbms_metadata.get_ddl( "TABLE", "T" ) from dual;
DBMS_METADATA.GET_DDL("TABLE","T")
--------------------------------------------------------------------------------
CREATE TABLE "sqle"."T"
( "X" NUMBER(*,0),
"Y" DATE,
"Z" CLOB,
P
SQL>
SQL>
SQL>
SQL> drop table t;
Table dropped.
SQL>
dbms_metadata.get_xml
SQL> set long 32000
SQL> set heading off
SQL> set pagesize 32000
SQL> spool xml
SQL>
SQL> select dbms_metadata.get_xml("TABLE", "emp", "sqle") from dual;
SQL>
SQL> spool off
SQL> Set heading on
SQL> set pagesize 20
SQL>
SQL>