<div class="codebody" id="code87674"> select dbms_Metadata.get_ddl('TABLE','TABLE_NAME','TABLEOWNER') from dual; select dbmsMetadata.get_ddl('INDEX','INDEX_NAME','INDEXOWNER') from dual; select dbmsMetadata.get_ddl('VIEW','VIEW_NAME','VIEWOWNER') from dual; select dbmsMetadata.get_ddl('PROCEDURE','PROCEDURE_NAME','PROCEDUREOWNER') from dual; select dbmsMetadata.get_ddl('FUNCTION','FUNCTION_NAME','FUNCTION_OWNER') from dual;
<div class="codebody" id="code65648"> set pagesize 0 set long 90000 set Feedback off set echo off spool schema_ddl.sql SELECT DBMS_MetaDATA.GET_DDL('TABLE',u.table_name,u.owner) FROM DBATABLES u; SELECT DBMSMetaDATA.GET_DDL('VIEW',u.view_name,u.owner) FROM DBAVIEWS u; SELECT DBMSMetaDATA.GET_DDL('INDEX',u.index_name,u.owner) FROM DBAINDEXES u; select dbmsMetadata.get_ddl('PROCEDURE',u.object_name,u.owner,) from dba_objects u where u.objecttype = 'PROCEDURE'; select dbmsMetadata.get_ddl('FUNCTION',) from dba_objects u where u.object_type = 'FUNCTION'; spool off;