home *** CD-ROM | disk | FTP | other *** search
/ Winzipper / Winzipper_ISO.iso / programming / oracle7 7.2 / DB / UTIL72 / CAT715.SQL < prev    next >
Encoding:
Text File  |  1995-05-09  |  17.7 KB  |  534 lines

  1. rem 
  2. rem $Header: cat715.sql 7020100.1 94/09/23 22:14:34 cli Generic<base> $ 
  3. rem 
  4. Rem  Copyright (c) 1991 by Oracle Corporation 
  5. Rem    NAME
  6. Rem      cat715.sql - Migrate 7.0.14 to 7.0.15
  7. Rem    DESCRIPTION
  8. Rem      RIGHT AFTER A 7.0.14 DATABASE IS STARTED UP USING 7.0.15
  9. Rem      FOR THE FIRST TIME, RUN THIS SCRIPT ONCE AS INTERNAL.
  10. Rem      A 7.0.14 database is a database that has been created using
  11. Rem      7.0.14 release or upgraded to use 7.0.14 release.
  12. Rem    MODIFIED   (MM/DD/YY)
  13. Rem     wmaimone   05/07/93 -  Creation for #161964.
  14.  
  15. Rem
  16. Rem  Fix up ALL_* views to take system privileges into account.
  17.  
  18. create or replace view ALL_OBJECTS
  19.     (OWNER, OBJECT_NAME, OBJECT_ID, OBJECT_TYPE,
  20.      CREATED, LAST_DDL_TIME, TIMESTAMP, STATUS)
  21. as
  22. select u.name, o.name, o.obj#,
  23.        decode(o.type, 0, 'NEXT OBJECT', 1, 'INDEX', 2, 'TABLE', 3, 'CLUSTER',
  24.                       4, 'VIEW', 5, 'SYNONYM', 6, 'SEQUENCE', 
  25.                       7, 'PROCEDURE', 8, 'FUNCTION', 9, 'PACKAGE',
  26.                       11, 'PACKAGE BODY', 12, 'TRIGGER', 'UNDEFINED'),
  27.        o.ctime, o.mtime,
  28.        to_char(o.stime, 'YYYY-MM-DD:HH24:MI:SS'),
  29.        decode(o.status, 0, 'N/A', 1, 'VALID', 'INVALID')
  30. from sys.obj$ o, sys.user$ u
  31. where o.owner# = u.user#
  32.   and o.linkname is null
  33.   and o.type != 10
  34.   and
  35.   (
  36.     o.owner# in (uid, 1 /* PUBLIC */)
  37.     or
  38.     (
  39.       o.type != 11 /* EXECUTE priv does not let user see pkg body */
  40.       and
  41.       o.obj# in (select obj# from sys.objauth$
  42.                  where grantee# in (select kzsrorol from x$kzsro)
  43.                    and privilege# in (3 /* DELETE */,   6 /* INSERT */,
  44.                                       7 /* LOCK */,     9 /* SELECT */,
  45.                                       10 /* UPDATE */, 12 /* EXECUTE */))
  46.     )
  47.     or
  48.     (
  49.        o.type in (7, 8, 9) /* prc, fcn, pkg */
  50.        and
  51.        exists (select null from v$enabledprivs
  52.            where priv_number = -144 /* EXECUTE ANY PROCEDURE */)
  53.     )
  54.     or
  55.     (
  56.        o.type in (2, 4, 5) /* table, view, synonym */
  57.        and
  58.        exists (select null from v$enabledprivs
  59.                where priv_number in (-45 /* LOCK ANY TABLE */,
  60.                      -47 /* SELECT ANY TABLE */,
  61.                      -48 /* INSERT ANY TABLE */,
  62.                      -49 /* UPDATE ANY TABLE */,
  63.                      -50 /* DELETE ANY TABLE */)
  64.                )
  65.     )
  66.     or
  67.     ( o.type = 6 /* sequence */
  68.       and
  69.       exists (select null from v$enabledprivs
  70.               where priv_number = -109 /* SELECT ANY SEQUENCE */)
  71.     )
  72.   )
  73. /
  74. remark
  75. remark  This view shows all tables, views, synonyms, and sequences owned by the
  76. remark  user and those tables, views, synonyms, and sequences that PUBLIC
  77. remark  has been granted access.
  78. remark
  79. create or replace view ALL_CATALOG
  80.     (OWNER, TABLE_NAME,
  81.      TABLE_TYPE)
  82. as
  83. select u.name, o.name,
  84.        decode(o.type, 0, 'NEXT OBJECT', 1, 'INDEX', 2, 'TABLE', 3, 'CLUSTER',
  85.                       4, 'VIEW', 5, 'SYNONYM', 6, 'SEQUENCE', 'UNDEFINED')
  86. from sys.user$ u, sys.obj$ o
  87. where o.owner# = u.user#
  88.   and o.type in (2, 4, 5, 6)
  89.   and o.linkname is null
  90.   and (o.owner# in (uid, 1)   /* public objects */
  91.        or
  92.        obj# in ( select obj#  /* directly granted privileges */
  93.                  from sys.objauth$
  94.                  where grantee# in ( select kzsrorol
  95.                                       from x$kzsro
  96.                                     )
  97.                 )
  98.        or
  99.        (
  100.       o.type in (7, 8, 9) /* prc, fcn, pkg */
  101.       and
  102.       exists (select null from v$enabledprivs
  103.           where priv_number = -144 /* EXECUTE ANY PROCEDURE */)
  104.         )
  105.        or
  106.        (
  107.       o.type in (2, 4, 5) /* table, view, synonym */
  108.       and
  109.       exists (select null from v$enabledprivs
  110.           where priv_number in (-45 /* LOCK ANY TABLE */,
  111.                     -47 /* SELECT ANY TABLE */,
  112.                     -48 /* INSERT ANY TABLE */,
  113.                     -49 /* UPDATE ANY TABLE */,
  114.                     -50 /* DELETE ANY TABLE */))
  115.        )
  116.        or
  117.        ( o.type = 6 /* sequence */
  118.      and
  119.      exists (select null from v$enabledprivs
  120.          where priv_number = -109 /* SELECT ANY SEQUENCE */)))
  121. /
  122.  
  123. create or replace view ALL_COL_COMMENTS
  124.     (OWNER, TABLE_NAME, COLUMN_NAME, COMMENTS)
  125. as
  126. select u.name, o.name, c.name, co.comment$
  127. from sys.obj$ o, sys.col$ c, sys.user$ u, sys.com$ co
  128. where o.owner# = u.user#
  129.   and o.type in (2, 4, 5)
  130.   and o.obj# = c.obj#
  131.   and c.obj# = co.obj#(+)
  132.   and c.col# = co.col#(+)
  133.   and (o.owner# = uid
  134.        or o.obj# in
  135.          (select obj#
  136.           from sys.objauth$
  137.           where grantee# in ( select kzsrorol
  138.                               from x$kzsro
  139.                             )
  140.           )
  141.        or
  142.      exists (select null from v$enabledprivs
  143.              where priv_number in (-45 /* LOCK ANY TABLE */,
  144.                        -47 /* SELECT ANY TABLE */,
  145.                        -48 /* INSERT ANY TABLE */,
  146.                        -49 /* UPDATE ANY TABLE */,
  147.                        -50 /* DELETE ANY TABLE */))
  148.       )
  149. /
  150. remark
  151. remark  This view does not include cluster indexes on clusters
  152. remark  containing tables which are accessible to the user.
  153. remark
  154. create or replace view ALL_INDEXES
  155.     (OWNER, INDEX_NAME, TABLE_OWNER, TABLE_NAME,
  156.      TABLE_TYPE,
  157.      UNIQUENESS,
  158.      TABLESPACE_NAME, INI_TRANS, MAX_TRANS,
  159.      INITIAL_EXTENT, NEXT_EXTENT, MIN_EXTENTS, MAX_EXTENTS, PCT_INCREASE,
  160.      PCT_FREE, BLEVEL, LEAF_BLOCKS, DISTINCT_KEYS, AVG_LEAF_BLOCKS_PER_KEY,
  161.      AVG_DATA_BLOCKS_PER_KEY, CLUSTERING_FACTOR, STATUS)
  162.  as 
  163. select u.name, o.name, iu.name, io.name, 'TABLE',
  164.        decode(i.unique$, 0, 'NONUNIQUE', 1, 'UNIQUE', 'UNDEFINED'), 
  165.        ts.name, i.initrans, i.maxtrans,
  166.        s.iniexts * ts.blocksize, s.extsize * ts.blocksize, 
  167.        s.minexts, s.maxexts, s.extpct, i.pctfree$,
  168.        i.blevel, i.leafcnt, i.distkey, i.lblkkey, i.dblkkey, i.clufac,
  169.        decode(i.compress$, 2, 'DIRECT LOAD', 'VALID')
  170. from sys.ts$ ts, sys.seg$ s, sys.user$ iu, sys.obj$ io, 
  171.      sys.user$ u, sys.ind$ i, sys.obj$ o
  172. where u.user# = o.owner#
  173.   and o.obj# = i.obj#
  174.   and i.bo# = io.obj#
  175.   and io.owner# = iu.user# 
  176.   and io.type = 2 /* tables */
  177.   and i.ts# = ts.ts# 
  178.   and i.file# = s.file#
  179.   and i.block# = s.block# 
  180.   and (io.owner# = uid
  181.         or
  182.        io.obj# in ( select obj#
  183.                     from objauth$
  184.                     where grantee# in ( select kzsrorol
  185.                                         from x$kzsro
  186.                                       )
  187.                    )
  188.         or
  189.      exists (select null from v$enabledprivs
  190.              where priv_number in (-45 /* LOCK ANY TABLE */,
  191.                        -47 /* SELECT ANY TABLE */,
  192.                        -48 /* INSERT ANY TABLE */,
  193.                        -49 /* UPDATE ANY TABLE */,
  194.                        -50 /* DELETE ANY TABLE */)
  195.                  )
  196.        )
  197. /
  198. create or replace view ALL_IND_COLUMNS
  199.     (INDEX_OWNER, INDEX_NAME,
  200.      TABLE_OWNER, TABLE_NAME,
  201.      COLUMN_NAME, COLUMN_POSITION, COLUMN_LENGTH)
  202. as
  203. select io.name, idx.name, bo.name, base.name, 
  204.        c.name, ic.pos#, c.length
  205. from sys.col$ c, sys.obj$ idx, sys.obj$ base, sys.icol$ ic,
  206.      sys.user$ io, sys.user$ bo
  207. where base.obj# = c.obj#
  208.   and ic.col# = c.col#
  209.   and ic.bo# = base.obj#
  210.   and io.user# = idx.owner#
  211.   and bo.user# = base.owner#
  212.   and ic.obj# = idx.obj#
  213.   and (idx.owner# = uid or
  214.        base.owner# = uid
  215.        or
  216.        base.obj# in ( select obj#
  217.                      from sys.objauth$
  218.                      where grantee# in ( select kzsrorol
  219.                                          from x$kzsro
  220.                                        )
  221.                    )
  222.         or
  223.      exists (select null from v$enabledprivs
  224.              where priv_number in (-45 /* LOCK ANY TABLE */,
  225.                        -47 /* SELECT ANY TABLE */,
  226.                        -48 /* INSERT ANY TABLE */,
  227.                        -49 /* UPDATE ANY TABLE */,
  228.                        -50 /* DELETE ANY TABLE */)
  229.                  )
  230.        )
  231. /
  232. create or replace view ALL_SEQUENCES
  233.   (SEQUENCE_OWNER, SEQUENCE_NAME, 
  234.                   MIN_VALUE, MAX_VALUE, INCREMENT_BY,
  235.                   CYCLE_FLAG, ORDER_FLAG, CACHE_SIZE, LAST_NUMBER)
  236. as select u.name, o.name,
  237.       s.minvalue, s.maxvalue, s.increment$, 
  238.       decode (s.cycle, 0, 'N', 1, 'Y'),
  239.       decode (s.order$, 0, 'N', 1, 'Y'),
  240.       s.cache, s.highwater
  241. from sys.seq$ s, sys.obj$ o, sys.user$ u
  242. where u.user# = o.owner#
  243.   and o.obj# = s.obj#
  244.   and (o.owner# = uid
  245.        or o.obj# in
  246.             (select oa.obj#
  247.              from sys.objauth$ oa
  248.              where grantee# in ( select kzsrorol
  249.                                  from x$kzsro
  250.                                )
  251.             )
  252.         or
  253.      exists (select null from v$enabledprivs
  254.              where priv_number = -109 /* SELECT ANY SEQUENCE */
  255.                  )
  256.       )
  257. /
  258. remark
  259. remark  This view shows all synonyms owned by the user (private synonyms),
  260. remark  plus all public synonyms.
  261. remark
  262. create or replace view ALL_SYNONYMS
  263.     (OWNER, SYNONYM_NAME, TABLE_OWNER, TABLE_NAME, DB_LINK)
  264. as
  265. select u.name, o.name, s.owner, s.name, s.node
  266. from sys.user$ u, sys.syn$ s, sys.obj$ o
  267. where o.obj# = s.obj#
  268.   and o.type = 5
  269.   and o.owner# = u.user#
  270.   and (
  271.        o.owner# in (UID, 1 /* PUBLIC */)  /* user's private, any public */
  272.        or /* user has any privs on base object */
  273.     exists
  274.         (select null from sys.objauth$ ba, sys.obj$ bo, sys.user$ bu
  275.          where bu.name = s.owner
  276.            and bo.name = s.name
  277.            and bu.user# = bo.owner#
  278.            and ba.obj# = bo.obj#
  279.            and ba.grantee# in (select kzsrorol from x$kzsro))
  280.         or /* user has system privileges */
  281.      exists (select null from v$enabledprivs
  282.              where priv_number in (-45 /* LOCK ANY TABLE */,
  283.                        -47 /* SELECT ANY TABLE */,
  284.                        -48 /* INSERT ANY TABLE */,
  285.                        -49 /* UPDATE ANY TABLE */,
  286.                        -50 /* DELETE ANY TABLE */)
  287.                  )
  288.        )
  289. /
  290. create or replace view ALL_TABLES
  291.     (OWNER, TABLE_NAME, TABLESPACE_NAME, CLUSTER_NAME,
  292.      PCT_FREE, PCT_USED,
  293.      INI_TRANS, MAX_TRANS,
  294.      INITIAL_EXTENT, NEXT_EXTENT,
  295.      MIN_EXTENTS, MAX_EXTENTS, PCT_INCREASE,
  296.      BACKED_UP, NUM_ROWS, BLOCKS, EMPTY_BLOCKS,
  297.      AVG_SPACE, CHAIN_CNT, AVG_ROW_LEN)
  298. as
  299. select u.name, o.name, ts.name, co.name,
  300.        t.pctfree$, t.pctused$,
  301.        t.initrans, t.maxtrans,
  302.        s.iniexts * ts.blocksize, s.extsize * ts.blocksize,
  303.        s.minexts, s.maxexts, s.extpct,
  304.        decode(t.modified, 0, 'Y', 1, 'N', '?'),
  305.        t.rowcnt, t.blkcnt, t.empcnt, t.avgspc, t.chncnt, t.avgrln    
  306. from sys.user$ u, sys.ts$ ts, sys.seg$ s, sys.obj$ co, sys.tab$ t, sys.obj$ o
  307. where o.owner# = u.user#
  308.   and o.obj# = t.obj#
  309.   and t.clu# = co.obj# (+)
  310.   and t.ts# = ts.ts#
  311.   and t.file# = s.file# (+)
  312.   and t.block# = s.block# (+)
  313.   and (o.owner# = uid
  314.        or o.obj# in
  315.             (select oa.obj#
  316.              from sys.objauth$ oa
  317.              where grantee# in ( select kzsrorol
  318.                                  from x$kzsro
  319.                                ) 
  320.             )
  321.        or /* user has system privileges */
  322.      exists (select null from v$enabledprivs
  323.              where priv_number in (-45 /* LOCK ANY TABLE */,
  324.                        -47 /* SELECT ANY TABLE */,
  325.                        -48 /* INSERT ANY TABLE */,
  326.                        -49 /* UPDATE ANY TABLE */,
  327.                        -50 /* DELETE ANY TABLE */)
  328.                  )
  329.       )
  330. /
  331. create or replace view ALL_TAB_COLUMNS
  332.     (OWNER, TABLE_NAME,
  333.      COLUMN_NAME, 
  334.      DATA_TYPE,
  335.      DATA_LENGTH, DATA_PRECISION, DATA_SCALE,
  336.      NULLABLE, COLUMN_ID, DEFAULT_LENGTH, DATA_DEFAULT,
  337.      NUM_DISTINCT, LOW_VALUE, HIGH_VALUE,DENSITY)
  338. as
  339. select u.name, o.name,
  340.        c.name,
  341.        decode(c.type#, 1, 'VARCHAR2',
  342.                        2, decode(c.scale, null,
  343.                                  decode(c.precision, null, 'NUMBER', 'FLOAT'),
  344.                                  'NUMBER'),
  345.                        8, 'LONG', 9, 'VARCHAR',
  346.                        12, 'DATE', 23, 'RAW', 24, 'LONG RAW',
  347.                        69, 'ROWID',96,'CHAR', 105, 'MLSLABEL',
  348.                        106, 'MLSLABEL', 'UNDEFINED'),
  349.        c.length, c.precision, c.scale,
  350.        decode(sign(c.null$),-1,'D', 0, 'Y', 'N'), c.col#, c.deflength, 
  351.     c.default$,
  352.        c.distcnt, c.lowval, c.hival, c.spare2
  353. from sys.col$ c, sys.obj$ o, sys.user$ u
  354. where o.obj# = c.obj#
  355.   and o.owner# = u.user#
  356.   and o.type in (2, 3, 4)
  357.   and (o.owner# = uid
  358.         or
  359.         o.obj# in ( select obj#
  360.                     from sys.objauth$
  361.                     where grantee# in ( select kzsrorol
  362.                                          from x$kzsro
  363.                                        )
  364.                   )
  365.     or /* user has system privileges */
  366.       exists (select null from v$enabledprivs
  367.           where priv_number in (-45 /* LOCK ANY TABLE */,
  368.                     -47 /* SELECT ANY TABLE */,
  369.                     -48 /* INSERT ANY TABLE */,
  370.                     -49 /* UPDATE ANY TABLE */,
  371.                     -50 /* DELETE ANY TABLE */)
  372.           )
  373.        )
  374. /
  375. create or replace view ALL_TAB_COMMENTS
  376.     (OWNER, TABLE_NAME,
  377.      TABLE_TYPE,
  378.      COMMENTS)
  379. as
  380. select u.name, o.name,
  381.        decode(o.type, 0, 'NEXT OBJECT', 1, 'INDEX', 2, 'TABLE', 3, 'CLUSTER',
  382.                       4, 'VIEW', 5, 'SYNONYM', 'UNDEFINED'),
  383.        c.comment$
  384. from sys.obj$ o, sys.user$ u, sys.com$ c
  385. where o.owner# = u.user#
  386.   and o.obj# = c.obj#(+)
  387.   and c.col#(+) is null
  388.   and o.type in (2, 4)
  389.   and (o.owner# = uid
  390.         or
  391.         o.obj# in ( select obj#
  392.                     from sys.objauth$
  393.                     where grantee# in ( select kzsrorol
  394.                                          from x$kzsro
  395.                                        )
  396.                   )
  397.     or /* user has system privileges */
  398.       exists (select null from v$enabledprivs
  399.           where priv_number in (-45 /* LOCK ANY TABLE */,
  400.                     -47 /* SELECT ANY TABLE */,
  401.                     -48 /* INSERT ANY TABLE */,
  402.                     -49 /* UPDATE ANY TABLE */,
  403.                     -50 /* DELETE ANY TABLE */)
  404.           )
  405.        )
  406. /
  407. create or replace view ALL_VIEWS
  408.     (OWNER, VIEW_NAME, TEXT_LENGTH, TEXT)
  409. as
  410. select u.name, o.name, v.textlength, v.text
  411. from sys.obj$ o, sys.view$ v, sys.user$ u
  412. where o.obj# = v.obj#
  413.   and o.owner# = u.user#
  414.   and (o.owner# = uid
  415.        or o.obj# in
  416.             (select oa.obj#
  417.              from sys.objauth$ oa
  418.              where oa.grantee# in ( select kzsrorol
  419.                                          from x$kzsro
  420.                                   )
  421.             )
  422.     or /* user has system privileges */
  423.       exists (select null from v$enabledprivs
  424.           where priv_number in (-45 /* LOCK ANY TABLE */,
  425.                     -47 /* SELECT ANY TABLE */,
  426.                     -48 /* INSERT ANY TABLE */,
  427.                     -49 /* UPDATE ANY TABLE */,
  428.                     -50 /* DELETE ANY TABLE */)
  429.           )
  430.       )
  431. /
  432. create or replace view ALL_CONSTRAINTS 
  433.     (OWNER, CONSTRAINT_NAME, CONSTRAINT_TYPE,
  434.      TABLE_NAME, SEARCH_CONDITION, R_OWNER,
  435.      R_CONSTRAINT_NAME, DELETE_RULE, STATUS)
  436. as
  437. select ou.name, oc.name,
  438.        decode(c.type, 1, 'C', 2, 'P', 3, 'U',
  439.               4, 'R', 5, 'V',7,'C', '?'),
  440.        o.name, c.condition, ru.name, rc.name,
  441.        decode(c.type, 4,
  442.               decode(c.refact, 1, 'CASCADE', 'NO ACTION'), NULL),
  443.        decode(c.type, 5, 'ENABLED',
  444.               decode(c.enabled, NULL, 'DISABLED','ENABLED'))
  445. from sys.con$ oc, sys.con$ rc, sys.user$ ou, sys.user$ ru,
  446.      sys.obj$ o, sys.cdef$ c
  447. where oc.owner# = ou.user#
  448.   and oc.con# = c.con#
  449.   and c.obj# = o.obj#
  450.   and c.rcon# = rc.con#(+)
  451.   and rc.owner# = ru.user#(+)
  452.   and (o.owner# = uid
  453.        or o.obj# in (select obj#
  454.                      from sys.objauth$
  455.                      where grantee# in ( select kzsrorol
  456.                                          from x$kzsro
  457.                                        )
  458.                     )
  459.     or /* user has system privileges */
  460.       exists (select null from v$enabledprivs
  461.           where priv_number in (-45 /* LOCK ANY TABLE */,
  462.                     -47 /* SELECT ANY TABLE */,
  463.                     -48 /* INSERT ANY TABLE */,
  464.                     -49 /* UPDATE ANY TABLE */,
  465.                     -50 /* DELETE ANY TABLE */)
  466.           )
  467.       )
  468. /
  469. create or replace view ALL_CONS_COLUMNS 
  470.     (OWNER, CONSTRAINT_NAME, TABLE_NAME, COLUMN_NAME, POSITION)
  471. as
  472. select u.name, c.name, o.name, col.name, cc.pos#
  473. from sys.user$ u, sys.con$ c, sys.col$ col, sys.ccol$ cc, sys.cdef$ cd,
  474.      sys.obj$ o
  475. where c.owner# = u.user#
  476.   and c.con# = cd.con#
  477.   and cd.con# = cc.con#
  478.   and cc.obj# = col.obj#
  479.   and cc.col# = col.col#
  480.   and cc.obj# = o.obj#
  481.   and (c.owner# = uid
  482.        or cd.obj# in (select obj#
  483.                       from sys.objauth$
  484.                       where grantee# in ( select kzsrorol
  485.                                          from x$kzsro
  486.                                        )
  487.                      )
  488.     or /* user has system privileges */
  489.       exists (select null from v$enabledprivs
  490.           where priv_number in (-45 /* LOCK ANY TABLE */,
  491.                     -47 /* SELECT ANY TABLE */,
  492.                     -48 /* INSERT ANY TABLE */,
  493.                     -49 /* UPDATE ANY TABLE */,
  494.                     -50 /* DELETE ANY TABLE */)
  495.           )
  496.       )
  497. /
  498. create or replace view syscatalog_ 
  499.     (tname, creator, creatorid, tabletype, remarks)
  500.   as
  501.   select o.name, u.name, o.owner#,
  502.          decode(o.type, 2, 'TABLE', 4, 'VIEW', 6, 'SEQUENCE','?'), c.comment$
  503.   from    sys.user$ u, sys.obj$ o, sys.com$ c
  504.   where u.user# = o.owner#
  505.     and    o.type in (2, 4, 6)
  506.     and o.linkname is null
  507.     and o.obj# = c.obj#(+)
  508.     and ( o.owner# = uid
  509.       or o.obj# in
  510.          (select oa.obj#
  511.           from   sys.objauth$ oa
  512.           where  oa.grantee# in (uid, 1)
  513.           )
  514.       or
  515.       (
  516.       o.type in (2, 4) /* table, view */
  517.       and
  518.       exists (select null from v$enabledprivs
  519.           where priv_number in (-45 /* LOCK ANY TABLE */,
  520.                     -47 /* SELECT ANY TABLE */,
  521.                     -48 /* INSERT ANY TABLE */,
  522.                     -49 /* UPDATE ANY TABLE */,
  523.                     -50 /* DELETE ANY TABLE */)
  524.           )
  525.        )
  526.       or
  527.      ( o.type = 6 /* sequence */
  528.        and
  529.        exists (select null from v$enabledprivs
  530.            where priv_number = -109 /* SELECT ANY SEQUENCE */)
  531.      )
  532.        )
  533. /
  534.