Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Find foreign key with index name

N_RajAug 4 2021

Hi All,

We have oracle 18c.
I need a sql to find a foreign key with indexes in a schema.
I tried the below but i couldn't get any result.

select uc.table_name as table_name, uc.constraint_name as constraint_name,uc.index_name
from dba_constraints uc
where uc.constraint_type='R'
and exists
(select ucc.position, ucc.column_name
from dba_cons_columns ucc
where ucc.constraint_name=uc.constraint_name and ucc.owner='ABC_OTO_PROV'
union
select uic.column_position as position, uic.column_name
from dba_ind_columns uic
where uic.table_name=uc.table_name and uic.table_owner='ABC_OTO_PROV'
); 

Please anyone share your suggestions

Thanks,

Comments
Post Details
Added on Aug 4 2021
1 comment
938 views