老熟女激烈的高潮_日韩一级黄色录像_亚洲1区2区3区视频_精品少妇一区二区三区在线播放_国产欧美日产久久_午夜福利精品导航凹凸

重慶分公司,新征程啟航

為企業提供網站建設、域名注冊、服務器等服務

oracle中怎么看外鍵 oracle查詢表外鍵

oracle怎么查看外鍵在哪個表

有時候刪除某張表記錄的時候,會報錯外鍵約束不能刪除。

公司主營業務:成都網站設計、網站建設、外貿網站建設、移動網站開發等業務。幫助企業客戶真正實現互聯網宣傳,提高企業的競爭能力。創新互聯公司是一支青春激揚、勤奮敬業、活力青春激揚、勤奮敬業、活力澎湃、和諧高效的團隊。公司秉承以“開放、自由、嚴謹、自律”為核心的企業文化,感謝他們對我們的高要求,感謝他們從不同領域給我們帶來的挑戰,讓我們激情的團隊有機會用頭腦與智慧不斷的給客戶帶來驚喜。創新互聯公司推出容城免費做網站回饋大家。

如果不了解表之間的關系,可以通過以下語句查詢到外鍵是建在哪張表上的:

select * from dba_constraints where constraint_name='xxx' and constraint_type = 'R';

例如:我的程序日志中報如下錯誤,我要知道外鍵是在那個表上.

2015-09-08

18:28:18 [ main:261597003 ] - [ ERROR ] java.sql.SQLException:

ORA-02291: 違反完整約束條件 (IRP.FK66EC57AF5158B9FB) - 未找到父項關鍵字

select * from dba_constraints where constraint_name='FK66EC57AF5158B9FB' and constraint_type = 'R';

例如:

執行delete from tablename時報錯:

ORA-02292: integrity constraint (CCSYS.FK_T_BME_TASKRUNRESULT_TASKID) violated - child record found

可以通過執行

select table_name from dba_constraints where constraint_name='FK_T_BME_TASKRUNRESULT_TASKID' and constraint_type = 'R';

查詢出外鍵是建在T_BME_TASKRUNRESULT表上的,先把T_BME_TASKRUNRESULT表刪除,就可以刪除 t_bme_task表記錄了。

Oracle查看表索引、主鍵、外鍵、約束

查看表索引、主鍵、外鍵、約束

(包括索引名,類型,構成列)

SELECT T.*, I.INDEX_TYPE

FROM USER_IND_COLUMNS T,USER_INDEXES I

WHERE T.INDEX_NAME = I.INDEX_NAME

AND T.TABLE_NAME = I.TABLE_NAME

AND T.TABLE_NAME = 'ORG_DLF' ----指定表

AND T.TABLE_OWNER= 'ODSRPT_SIT2'; ----指定用戶

(包括名稱,構成列)

SELECT CU.*

FROM DBA_CONS_COLUMNS CU, DBA_CONSTRAINTS AU

WHERE CU.CONSTRAINT_NAME = AU.CONSTRAINT_NAME

AND AU.CONSTRAINT_TYPE = 'P'

AND AU.TABLE_NAME = 'LOAN_APPLICATION_FEE' -----指定表名

AND CU.OWNER='ODSRPT_SIT2'; -----指定用戶名

(包括表名稱,構成列)

SELECT CU.COLUMN_NAME,AU.TABLE_NAME

FROM DBA_CONS_COLUMNS CU, DBA_CONSTRAINTS AU

WHERE CU.CONSTRAINT_NAME = AU.CONSTRAINT_NAME

AND AU.CONSTRAINT_TYPE = 'U'

AND AU.OWNER='RPT_UAT2' -----指定用戶名

AND AU.TABLE_NAME = 表名 ; -----指定表名

Select a.Owner 外鍵擁有者,

a.Table_Name 外鍵表,

c.Column_Name 外鍵列,

b.Owner 主鍵擁有者,

b.Table_Name 主鍵表,

d.Column_Name 主鍵列,

c.Constraint_Name 外鍵名,

d.Constraint_Name 主鍵名

From User_Constraints a,

 user_Constraints b,

user_Cons_Columns c, --外鍵表

user_Cons_Columns d --主鍵表

Where a.r_Constraint_Name = b.Constraint_Name

And a.Constraint_Type = 'R'

And b.Constraint_Type = 'P'

And a.r_Owner = b.Owner

And a.Constraint_Name = c.Constraint_Name

And b.Constraint_Name = d.Constraint_Name

And a.Owner = c.Owner

And a.Table_Name = c.Table_Name

And b.Owner = d.Owner

And b.Table_Name = d.Table_Name;

在oracle中查詢表之間外鍵的執行語句怎么寫?

查找表的外鍵(包括名稱,引用表的表名和對應的鍵名,下面是分成多步查詢): \x0d\x0a\x0d\x0aselect * from user_constraints c where c.constraint_type = 'R' and c.table_name = 要查詢的表 \x0d\x0a\x0d\x0a查詢外鍵約束的列名: \x0d\x0a\x0d\x0aselect * from user_cons_columns cl where cl.constraint_name = 外鍵名稱 \x0d\x0a\x0d\x0a查詢引用表的鍵的列名: \x0d\x0a\x0d\x0aselect * from user_cons_columns cl where cl.constraint_name = 外鍵引用表的鍵名 \x0d\x0a\x0d\x0a查詢表的所有列及其屬性 \x0d\x0a\x0d\x0aselect t.*,c.COMMENTS from user_tab_columns t,user_col_comments c where t.table_name = c.table_name and t.column_name = c.column_name and t.table_name = 要查詢的表

如何在oracle中查詢所有用戶表的表名、主鍵名稱、索引、外鍵等

1、查找表的所有索引(包括索引名,類型,構成列):

select

t.*,i.index_type

from

user_ind_columns

t,user_indexes

i

where

t.index_name

=

i.index_name

and

t.table_name

=

i.table_name

and

t.table_name

=

要查詢的表

2、查找表的主鍵(包括名稱,構成列):

select

cu.*

from

user_cons_columns

cu,

user_constraints

au

where

cu.constraint_name

=

au.constraint_name

and

au.constraint_type

=

'P'

and

au.table_name

=

要查詢的表

3、查找表的唯一性約束(包括名稱,構成列):

select

column_name

from

user_cons_columns

cu,

user_constraints

au

where

cu.constraint_name

=

au.constraint_name

and

au.constraint_type

=

'U'

and

au.table_name

=

要查詢的表

4、查找表的外鍵(包括名稱,引用表的表名和對應的鍵名,下面是分成多步查詢):

select

*

from

user_constraints

c

where

c.constraint_type

=

'R'

and

c.table_name

=

要查詢的表

查詢外鍵約束的列名:

select

*

from

user_cons_columns

cl

where

cl.constraint_name

=

外鍵名稱

查詢引用表的鍵的列名:

select

*

from

user_cons_columns

cl

where

cl.constraint_name

=

外鍵引用表的鍵名

5、查詢表的所有列及其屬性

怎么查看oracle數據庫數據表外鍵

select distinct(ucc.column_name) column_name,rela.table_name,rela.column_name column_name1

from

user_constraints uc,user_cons_columns ucc,

(select t2.table_name,t2.column_name,t1.r_constraint_name from user_constraints t1,user_cons_columns t2 where t1.r_constraint_name=t2.constraint_name and t1.table_name='ONLINEXLS') rela

where

uc.constraint_name=ucc.constraint_name

and uc.r_constraint_name=rela.r_constraint_name

and uc.table_name='PRODUCT'


分享名稱:oracle中怎么看外鍵 oracle查詢表外鍵
本文來源:http://www.xueling.net.cn/article/hhijhg.html

其他資訊

在線咨詢
服務熱線
服務熱線:028-86922220
TOP
主站蜘蛛池模板: 看免费一级片 | 波多野结衣在线视频免费观看 | 练舞蹈被教练做高h | 久艹在线免费观看 | 日韩精品久久久久久久九岛 | 国产免费拔擦拔擦8x在线牛 | 粗大的内捧猛烈进出欧美 | 全免费一级毛片免费看 | 亚洲娇小性XXXXX | 91高清视频在线观看 | 亚洲欧美综合区丁香五月小说 | 伊人大杳焦在久久综合网 | 国产午夜草莓视频在线观看 | 深夜视频在线观看免费 | 久久久久无码精品国产H动漫 | MM1313亚洲精品无码 | 日产精品久久久久久久性色 | 日韩字幕在线 | 国产精品久久久久久久久晋中 | 亚洲瑟瑟 | 印度老妇性视频毛茸茸 | a国产在线v的不卡视频 | 动漫av一区 | 亚洲经典国产欧美 | 中文在线免费看视频 | 欧美一区二区高清在线观看 | xxxx69在线观看 | 无码国产69精品久久久孕妇 | 人妻少妇邻居少妇好多水在线 | 老司机久久精品 | 高清久久久久 | 亚洲一区二区 | 国产麻豆一区二区三区在线观看 | 国产成人无码精品一区在线观看 | 依依成人在线视频 | 人成在线视频 | 国产视频一区二区三区在线 | 国内免费精品视频 | 天天精品视频 | 欧洲色阁中文字幕 | 色婷婷久久一区二区三区麻豆 |