Oracle根據主鍵獲取對應表,Oracle根據外鍵獲取相關表


Oracle根據主鍵獲取對應表

select *
  from user_constraints a, USER_CONS_COLUMNS b
 where a.CONSTRAINT_TYPE = 'P'
   and a. constraint_name = b.constraint_name
   and a.constraint_name = 'PK151'; --根據主鍵名查詢表(PK151為主鍵名稱

 

Oracle根據外鍵獲取相關表

select *
  from user_constraints cc
 where cc.r_constraint_name in
       (select c.r_constraint_name
          from user_constraints c
         where c.constraint_type = 'R'
           and c.constraint_name = 'REFB_BJB125') --根據外鍵獲取相關的表(REFB_BJB125為外鍵名稱


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM