欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

oracle外鍵怎么找 oracle查看外鍵

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

1、查找表的所有索引(包括索引名,類型,構(gòu)成列): 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、查找表的主鍵(包括名稱,構(gòu)成列): 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、查找表的唯一性約束(包括名稱,構(gòu)成列): 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、查找表的外鍵(包括名稱,引用表的表名和對(duì)應(yīng)的鍵名,下面是分成多步查詢): 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、查詢表的所有列及其屬性

創(chuàng)新互聯(lián)公司服務(wù)緊隨時(shí)代發(fā)展步伐,進(jìn)行技術(shù)革新和技術(shù)進(jìn)步,經(jīng)過(guò)10年的發(fā)展和積累,已經(jīng)匯集了一批資深網(wǎng)站策劃師、設(shè)計(jì)師、專業(yè)的網(wǎng)站實(shí)施團(tuán)隊(duì)以及高素質(zhì)售后服務(wù)人員,并且完全形成了一套成熟的業(yè)務(wù)流程,能夠完全依照客戶要求對(duì)網(wǎng)站進(jìn)行網(wǎng)站設(shè)計(jì)制作、成都網(wǎng)站設(shè)計(jì)、建設(shè)、維護(hù)、更新和改版,實(shí)現(xiàn)客戶網(wǎng)站對(duì)外宣傳展示的首要目的,并為客戶企業(yè)品牌互聯(lián)網(wǎng)化提供全面的解決方案。

ORACLE中,如何根據(jù)已知的主鍵查詢所有引用這個(gè)主鍵的外鍵的表

在toad中選中表名,按F4,選擇Referential,即可看到關(guān)于此表關(guān)聯(lián)的主鍵或外鍵的表了,如附件圖。

oracle怎么查看外鍵在哪個(gè)表

有時(shí)候刪除某張表記錄的時(shí)候,會(huì)報(bào)錯(cuò)外鍵約束不能刪除。

如果不了解表之間的關(guān)系,可以通過(guò)以下語(yǔ)句查詢到外鍵是建在哪張表上的:

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

例如:我的程序日志中報(bào)如下錯(cuò)誤,我要知道外鍵是在那個(gè)表上.

2015-09-08

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

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

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

例如:

執(zhí)行delete from tablename時(shí)報(bào)錯(cuò):

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

可以通過(guò)執(zhí)行

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中查詢表之間外鍵的執(zhí)行語(yǔ)句怎么寫?

查找表的外鍵(包括名稱,引用表的表名和對(duì)應(yīng)的鍵名,下面是分成多步查詢):

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 = 外鍵引用表的鍵名

查詢表的所有列及其屬性

select 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查看表索引、主鍵、外鍵、約束

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

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

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'; ----指定用戶

(包括名稱,構(gòu)成列)

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'; -----指定用戶名

(包括表名稱,構(gòu)成列)

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數(shù)據(jù)庫(kù)數(shù)據(jù)表外鍵

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'

當(dāng)前題目:oracle外鍵怎么找 oracle查看外鍵
網(wǎng)站URL:http://chinadenli.net/article24/dooodje.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站策劃、企業(yè)建站、網(wǎng)站營(yíng)銷電子商務(wù)、企業(yè)網(wǎng)站制作、標(biāo)簽優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

小程序開發(fā)