oracle sql查询表外键关系

时间:2014-05-26 22:44:24   收藏:0   阅读:246

 

bubuko.com,布布扣
SELECT F.TABLE_NAME, F.CONSTRAINT_NAME, F.COLUMN_NAME, F.POSITION, P.TABLE_NAME, P.COLUMN_NAME, P.POSITION  ,R.OWNER
  FROM USER_CONSTRAINTS R, USER_CONS_COLUMNS F, USER_CONS_COLUMNS P 
WHERE 1=1
   and R.OWNER = UPPER(ATS001) 
   AND R.TABLE_NAME = UPPER(ACCOUNTRELATIONS) 
   AND R.CONSTRAINT_TYPE = R 
   AND R.CONSTRAINT_NAME = F.CONSTRAINT_NAME 
   AND R.R_CONSTRAINT_NAME = P.CONSTRAINT_NAME 
   AND F.POSITION = P.POSITION 
ORDER BY F.TABLE_NAME, F.CONSTRAINT_NAME, F.POSITION;
bubuko.com,布布扣

 

oracle sql查询表外键关系,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!