An Oracle Database knows a table and queries a table with a primary foreign key relationship.
-- Check whether the foreign key table NC56.CSCI has a corresponding primary key table SELECT. owner,. TABLE_NAME primary_table_name,. CONSTRAINT_NAME primary_table_key_name, B. owner, B. TABLE_NAME foreign_table_name, B. CONSTRAINT_NAME foreign_table_foreign_key_name, B. STATUS foreign_table_foreign_key_stat FROM DBA_CONSTRAINTS A, DBA_CONSTRAINTS B WHERE. CONSTRAINT_NAME = B. R _ CONSTRAINT_NAME and B. CONSTRAINT_TYPE = 'r' AND B. TABLE_NAME = 'csci 'and. owner = 'nc56' and B. owner = 'nc56' order by 1, 2, 3, 4;
-- Check whether the primary key table NC56.CBH has a corresponding foreign key table SELECT. owner,. TABLE_NAME primary_table_name,. CONSTRAINT_NAME primary_table_key_name, B. owner, B. TABLE_NAME foreign_table, B. CONSTRAINT_NAME foreign_table_foreign_key_name, B. STATUS foreign_table_foreign_key_stat FROM DBA_CONSTRAINTS A, DBA_CONSTRAINTS B WHERE. CONSTRAINT_NAME = B. R _ CONSTRAINT_NAME and B. CONSTRAINT_TYPE = 'r' AND. TABLE_NAME = 'cbh' and. owner = 'nc56' and B. owner = 'nc56' order by 1, 2, 3, 4;
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.