Some Java Guy Some Java Guy - 1 month ago 10
SQL Question

I need to check Table structure with triggers, constraints

I need to check complete DLL. I need a sql query for the same.

If I use

DESC
or
DESCRIBE
in Oracle, it shows me all columns and type.

But I also need all
Constraints
,
Triggers
acting on it, etc. Just like how Oracle SQL Developer shows the structure if you click on
SQL
tab.

What should be my query command?

Answer

The table definition with constraints:

select DBMS_METADATA.GET_DDL('TABLE', 'MY_TABLE' )
 from dual;

The triggers on table:

select DBMS_METADATA.GET_DDL('TRIGGER',trigger_name) from user_triggers where table_name='MY_TABLE';