Oracle - How to generate script from sql developer

后端 未结 10 531
臣服心动
臣服心动 2020-12-07 20:13

How to take script for schema of the tables, stored procedures of Oracle through SQL Developer tool (SQLPLUS command line interface)?

10条回答
  •  粉色の甜心
    2020-12-07 21:08

    If you want to see DDL for the objects, you can use

    select dbms_metadata.get_ddl('OBJECT_TYPE','OBJECT_NAME','OBJECT_OWNER') 
      from dual
    /
    

    For example this will give you the DDL script for emp table.

    select dbms_metadata.get_ddl('TABLE','EMP','HR') 
      from dual
    /
    

    You may need to set the long type format to big number. For packages, you need to access dba_source, user_source, all_source tables. You can query for object name and type to see what code is stored.

提交回复
热议问题