DBMS_METADATA.GET_DEPENDENT_DDL list all dependent on table in Oracle

Get all dependent ddl like index, constraint, trigger on object from DBMS METADATA package

I want to check my all table related DDLs like index in my table, Constraint in my table, Trigger on my table, REF Constraints on table.

Get the Dependent DDL of table in following example

spool EMP.sql

set heading off;
set echo off;
Set pages 999;
set long 90000;
exec dbms_metadata.set_transform_param(dbms_metadata.session_transform,'SQLTERMINATOR',true);

select dbms_metadata.get_ddl('TABLE','EMPLOYEES','HR') output from dual;

-- Index
select dbms_metadata.get_dependent_ddl('INDEX','EMPLOYEES','HR') output from dual;

-- Constraint
select dbms_metadata.get_dependent_ddl('CONSTRAINT','EMPLOYEES','HR') output from dual;

select dbms_metadata.get_dependent_ddl('REF_CONSTRAINT','EMPLOYEES','HR') output from dual;

-- Trigger
select dbms_metadata.get_dependent_ddl('TRIGGER','EMPLOYEES','HR') output from dual;

spool off

1. You can also disabled storage clause in definition of Oracle by executing following statement before generated DDL’s.


2. Enable the SQL Terminator after each object syntax completed.

exec dbms_metadata.set_transform_param(dbms_metadata.session_transform,'SQLTERMINATOR',true);

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.