Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to extract ddl of a package without package body

Tags:

oracle

plsql

I am using dbms_metadata.get_ddl function. I extract ddl of package and package body seperate and use them separately, so i dont need PACKAGE BODY's ddl when i ask for PACKAGE ddl. However get_ddl('PACKAGE',some_package) returns PACKAGE and PACKAGE BODY's ddls together. Is there a parameter to set, or anything else to make this possible...

like image 948
Serkan Kasapbaşı Avatar asked Oct 21 '10 07:10

Serkan Kasapbaşı


People also ask

How can I get DDL package?

You can get any package's get ddl ( create script ) as follows. SQL> SELECT DBMS_METADATA. GET_DDL('PACKAGE','OBJECT_NAME','SCHEMA_NAME') FROM DUAL; You can get any package's body get ddl ( create script ) as follows.

How do you get DDL of a procedure in Oracle?

To get the source of a stored procedure: select dbms_metadata. get_ddl('PROCEDURE', 'SOME_PROC') from dual; Using that you can create a SQL script that extracts everything and then spool the result to a file.


2 Answers

Try dbms_metadata.get_ddl('PACKAGE_SPEC', some_package instead) (there is similar with PACKAGE_BODY)

like image 105
GôTô Avatar answered Sep 23 '22 20:09

GôTô


For a well formated ddl extraction and easy to use you can get ZoraDDL. This is a little commandlinetool to extract DDL from the Database with many features. Look at ZorraDDL Homepage for more Information.

like image 32
Hans Avatar answered Sep 23 '22 20:09

Hans