In Oracle DB 12.1.0.2, SYS. ALL_CONSTRAINTS and SYS. ALL_CONS_COLUMNS are defined,

Source: Internet
Author: User

In Oracle DB 12.1.0.2, SYS. ALL_CONSTRAINTS and SYS. ALL_CONS_COLUMNS are defined,

SYS. ALL_CONSTRAINTS is defined as follows:

 

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 is defined as follows:

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#(+)

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.