Please see my other blog for Oracle EBusiness Suite Posts - EBMentors

Search This Blog

Note: All the posts are based on practical approach avoiding lengthy theory. All have been tested on some development servers. Please don’t test any post on production servers until you are sure.

Saturday, June 11, 2011

Finding FK for a Parent table



select owner,constraint_name,constraint_type,table_name,r_owner,r_constraint_name
     from all_constraints
    where constraint_type='R'
    and r_constraint_name in (select constraint_name from all_constraints
    where constraint_type in ('P','U') and table_name='T_LOOKUP');


select 'alter table '||a.owner||'.'||a.table_name||
            ' disable constraint '||a.constraint_name||';'
            from all_constraints a, all_constraints b
            where a.constraint_type = 'R'
            and a.r_constraint_name = b.constraint_name
            and a.r_owner  = b.owner
            and b.table_name = 'T_LOOKUP';

No comments: