Script : Generate SQL using a script which will produce the source code for a function /view /package via Metadata

As an Oracle developer, many times we want to quickly check the code of a given function/view/package or a package body to see the current code in the database may be as an output of a given SQL.

Take example of an object AP_INVOICES_PKG where we want to check the output 

SELECT    'select dbms_metadata.get_ddl('''

       || object_type

       || ''','''

       || object_name

       || ''') from dual;'

  FROM all_objects

 WHERE object_name = 'AP_INVOICES_PKG'

       AND object_type NOT IN ('PACKAGE BODY');

The above SQL will give an output as below

select dbms_metadata.get_ddl('PACKAGE','AP_INVOICES_PKG') from dual;

And when we run this SQL , we will get an output which is nothing but the code for package spec and package body for ap_invoices_pkg.

 


Comments

Popular posts from this blog

### Understanding fnd_request.submit_request and fnd_request.wait_for_request in Oracle E-Business Suite

Understanding Oracle R12 Encumbrance Accounting: Functionality, Standard Profiles, and Reports

Understanding the "Run Alone" Flag in Oracle E-Business Suite Concurrent Programs