In an Oracle database, you know a table that queries a table with its primary foreign key relationship

Source: Internet
Author: User

          --Check the foreign key table Nc56.csci there is no corresponding primary key table           SELECT A.owner,                  a.table_name      primary_table_name,                  a.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 a.constraint_name = b.r_constraint_name and              b.constraint_type = ' R ' and              b.table_ NAME = ' CSCI ' and a.owner= ' NC56 ' and b.owner= ' NC56 '            ORDER by 1, 2, 3, 4;            
           --Check the primary key table NC56.CBH there is no corresponding foreign key table           SELECT A.owner,                 a.table_name      primary_table_name,                  a.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 a.constraint_name = b.r_constraint_name and              b.constraint_type = ' R ' and              a.table_name = ' CBH ' and A. Owner= ' NC56 ' and  b.owner= ' NC56 '            ORDER by 1, 2, 3, 4;


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

In an Oracle database, you know a table that queries a table with its primary foreign key relationship

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.