Metadata Script

1. Overview

This document will be helpful to generate DDL scripts of objects using Oracle Plsql.

2. Technologies and Tools Used

  • Oracle Plsql code.

 

3. Use Case

To migrate Scripts from development instance to prod instance we used below method to get complete script.

4. Architecture 

We can achieve this by using below plsql code.

 

Code:

BEGIN

FOR i IN

(

Select distinct OBJECT_TYPE,OBJECT_NAME from all_objects

where OBJECT_TYPE= ‘TABLE’

and OBJECT_NAME in (‘EMP’,’ITEM_TB’)

)

LOOP

DBMS_OUTPUT.put_line (

DBMS_METADATA.get_ddl (i.OBJECT_TYPE, i.OBJECT_NAME)

);

DBMS_OUTPUT.put_line (‘/’);

END LOOP;

DBMS_OUTPUT.put_line (‘exit’);

END;

5. Screen Shot

Output:

Recent Posts