我是靠谱客的博主 飘逸芹菜,最近开发中收集的这篇文章主要介绍Oracle DB 12.1.0.2 中SYS.ALL_CONSTRAINTS的定义 和 SYS.ALL_CONS_COLUMNS的定义,觉得挺不错的,现在分享给大家,希望可以做个参考。
概述
SYS.ALL_CONSTRAINTS的定义如下:
CREATE OR REPLACE VIEW ALL_CONSTRAINTS AS
select OWNER, CONSTRAINT_NAME, CONSTRAINT_TYPE,
TABLE_NAME, SEARCH_CONDITION, SEARCH_CONDITION_VC,
R_OWNER, R_CONSTRAINT_NAME, DELETE_RULE, STATUS,
DEFERRABLE, DEFERRED, VALIDATED, GENERATED,
BAD, RELY, LAST_CHANGE, INDEX_OWNER, INDEX_NAME,
INVALID, VIEW_RELATED, ORIGIN_CON_ID
from INT$DBA_CONSTRAINTS
where (OWNER = SYS_CONTEXT('USERENV', 'CURRENT_USER')
or OBJ_ID(OWNER, TABLE_NAME, OBJECT_TYPE#, OBJECT_ID) in
(select obj# from sys.objauth$
where grantee# in ( select kzsrorol
from x$kzsro
)
)
or /* user has system privileges */
exists (select null from v$enabledprivs
where priv_number in (-45 /* LOCK ANY TABLE */,
-47 /* SELECT ANY TABLE */,
-397/* READ ANY TABLE */,
-48 /* INSERT ANY TABLE */,
-49 /* UPDATE ANY TABLE */,
-50 /* DELETE ANY TABLE */)
)
)
SYS.ALL_CONS_COLUMNS的定义如下:
CREATE OR REPLACE VIEW ALL_CONS_COLUMNS
(owner, constraint_name, table_name, column_name, position)
AS
select u.name, c.name, o.name,
decode(ac.name, null, col.name, ac.name), cc.pos#
from sys.user$ u, sys.con$ c, sys.col$ col, sys.ccol$ cc, sys.cdef$ cd,
sys."_CURRENT_EDITION_OBJ" o, sys.attrcol$ ac
where c.owner# = u.user#
and c.con# = cd.con#
and (cd.type# < 14 or cd.type# > 17) /* don't include supplog cons */
and (cd.type# != 12) /* don't include log group cons */
and cd.con# = cc.con#
and cc.obj# = col.obj#
and cc.intcol# = col.intcol#
and cc.obj# = o.obj#
and (c.owner# = userenv('SCHEMAID')
or cd.obj# in (select obj#
from sys.objauth$
where grantee# in ( select kzsrorol
from x$kzsro
)
)
or /* user has system privileges */
exists (select null from v$enabledprivs
where priv_number in (-45 /* LOCK ANY TABLE */,
-47 /* SELECT ANY TABLE */,
-397/* READ ANY TABLE */,
-48 /* INSERT ANY TABLE */,
-49 /* UPDATE ANY TABLE */,
-50 /* DELETE ANY TABLE */)
)
)
and col.obj# = ac.obj#(+)
and col.intcol# = ac.intcol#(+)
最后
以上就是飘逸芹菜为你收集整理的Oracle DB 12.1.0.2 中SYS.ALL_CONSTRAINTS的定义 和 SYS.ALL_CONS_COLUMNS的定义的全部内容,希望文章能够帮你解决Oracle DB 12.1.0.2 中SYS.ALL_CONSTRAINTS的定义 和 SYS.ALL_CONS_COLUMNS的定义所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复