老熟女激烈的高潮_日韩一级黄色录像_亚洲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
主站蜘蛛池模板: 91先生在线?看 | 4虎最新地址 | 成人午夜无码精品免费看 | 奇米影视第四色成人网 | 亚洲高清欧美日韩一区二区三区 | 久久无码中文字幕无码 | 日本一卡2卡三卡4卡无卡免费网站 | 精品一区乱 | 又粗又硬又黄a级毛片 | 国产在线精品拍揄自揄免费 | 欧美成人精品三级网站 | www.5588.com毛片 | 日本国产一区二区三区 | 亚洲国产综合在线 | 国产口爆吞精在线视频观看 | 手机a级毛片免费观看 | 中文精品无码中文字幕无码专区 | 蜜臀一区| 国产视频二区三区 | 边吃奶边扎下面好爽免费视频 | 国产一区二区日韩精品 | 无码人妻一区二区三区一 | 久久xxxx | 中文字幕一区在线观看 | 六月成人网| 视频免费观看在线 | 18禁美女裸体免费网站 | 国产嫩草在线视频 | 影音先锋人妻啪啪AV资源网站 | 色8久久久噜噜噜久久 | 风流少妇BBWBBW69视频 | 99精品国产一区二区 | 狠狠躁夜夜躁人人爽蜜桃 | 国产美女视频一区 | 国色天香乱码区 | 人人妻碰人人免费 | 护士毛片 | 91中文在线视频 | www.日韩av| 少妇p毛又多水又大又黑 | 乱h好大噗嗤噗嗤烂了 |