Oracle DB 12.1.0.2 中SYS.ALL_CONSTRAINTS的定義 和 SYS.ALL_CONS_COLUMNS的定義

來源:互聯網
上載者:User

標籤:

SYS.ALL_CONSTRAINTS的定義如下:

 

CREATE OR REPLACE VIEW ALL_CONSTRAINTS ASselect 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_IDfrom INT$DBA_CONSTRAINTSwhere (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)ASselect 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$ acwhere 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的定義

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.