SQL$HELP72.HLB  —  REVOKE
    Removes privileges from or entirely deletes an entry in the
    Oracle Rdb access control list (ACL) for a database object. Each
    entry in an access control list consists of an identifier (or
    role) and a list of privileges assigned to the identifier.

    o  Each identifier specifies a user or a set of users.

    o  The list of privileges specifies which operations that user or
       user group can perform on the database, table, column, module,
       procedure, function or sequence.

    When a user tries to perform an operation on a database, SQL
    reads the associated ACL from top to bottom, comparing the
    identifier of the user with each entry. As soon as SQL finds the
    first match, it grants the rights listed in that entry and stops
    the search. All identifiers that do not match a previous entry
    are compared with the subsequent entry, and if no match occurs,
    they receive the rights of ("fall through" to) the entry [*,*],
    if it exists. If no entry has the user identifier [*,*], then
    unmatched user identifiers are denied all access to the database,
    table, or column. For this reason, both the entries and their
    order in the list are important.

    To create an entry or add privileges to an entry in the Oracle
    Rdb access control list for a database object, see the GRANT
    statement.

1  –  Environment

    You can use the REVOKE statement:

    o  In interactive SQL

    o  Embedded in host language programs to be precompiled

    o  As part of a nonstored procedure in a nonstored SQL module

    o  In dynamic SQL as a statement to be dynamically executed

2  –  Format

  (B)0REVOKE qqqqqqqqqqqqqqqqqqqqqqqk                                         
  lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj                                         
  mwq> db-privs qqqqqqqq> ON DATABASE ALIAS qwwq> <alias> wwqqqqqqqqqqwqk 
   x                                         xmqqqqq , <qqjx          x x 
   x                                         mqqqqq> * qqqqj          x x
   tq> table-privs qqqqq> ON qwqqqqqqqqqqqwqqwwqwq> <table-name> wqwwqu x 
   x                          mq> TABLE qqj  xx mq> <view-name> qj xx x x 
   x                                         xmqqqqqqq , <qqqqqqqqqjx x x 
   x                                         mqqqqqqq> * qqqqqqqqqqqj x x
   tq> column-privs qqqq> ON COLUMN qqqwq> <column-name> qwqqqqqqqqqqqu x 
   x                                   mqqqqqqqq , <qqqqqqj           x x 
   tq> module-privs qqqq> ON MODULE qqwwq> <module-name> qwwqqqqqqqqqqu x 
   x                                  xmqqqqqqqq , <qqqqqqjx          x x 
   x                                  mqqqqqqqq> * qqqqqqqqj          x x
   tq> ext-routine-privs qwq> ON FUNCTION qqwwwq> <ext-rout-name> qwwqu x 
   x                      mq> ON PROCEDURE qjxmqqqqqqqqqqq , <qqqqqjx x x 
   x                                         mqqqqqqqqqqq> * qqqqqqqj x x 
   mq> sequence-privs qq> ON SEQUENCE qwwq><sequence-name> qwwqqqqqqqqj x 
                                       xmqqqqqqq , <qqqqqqqqjx          x 
                                       mqqqqqqq> * qqqqqqqqqqj          x
  lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj 
  mq> revoke-from qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq>

  (B)0db-privs=                           
                                      
  qqqqwqqqwqwq> SELECT qqqqqwqwqqqqwq>
      x   x tq> INSERT qqqqqu x    x  
      x   x tq> OPERATOR qqqu x    x  
      x   x tq> DELETE qqqqqu x    x  
      x   x tq> CREATE qqqqqu x    x  
      x   x tq> ALTER qqqqqqu x    x  
      x   x tq> DROP qqqqqqqu x    x  
      x   x tq> DBCTRL qqqqqu x    x  
      x   x tq> DBADM qqqqqqu x    x  
      x   x tq> SHOW qqqqqqqu x    x  
      x   x tq> REFERENCES qu x    x  
      x   x tq> UPDATE qqqqqu x    x  
      x   x tq> SECURITY qqqu x    x  
      x   x mq> DISTRIBTRAN j x    x  
      x   mqqqqqqq , <qqqqqqqqj    x  
      mqqqwqqq> ALL PRIVILEGES qwqqj  
          mqqq> ENTRY qqqqqqqqqqj     

  (B)0table-privs=                                            
                                                          
  qwqqwqwq> SELECT qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqwqwqwqq>
   x  x tq> INSERT qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu x x   
   x  x tq> DELETE qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu x x   
   x  x tq> CREATE qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu x x   
   x  x tq> ALTER qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu x x   
   x  x tq> DROP qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu x x   
   x  x tq> DBCTRL qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu x x   
   x  x tq> SHOW qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu x x   
   x  x tq> REFERENCES wqqqqqqqqqqqqqqqqqqqqqqqqqqu x x   
   x  x x              m> ( w> <column-name> w> ) u x x   
   x  x x                   mqqqqq , <qqqqqqqj    x x x   
   x  x mq> UPDATE wqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu x x   
   x  x            m> ( w> <column-name> qqwqq> ) j x x   
   x  x                 mqqqqq , <qqqqqqqqqj        x x   
   x  mqqqqqqqqqqqqqqqqqqq , <qqqqqqqqqqqqqqqqqqqqqqj x   
   mqqqwqq> ALL PRIVILEGES qqwqqqqqqqqqqqqqqqqqqqqqqqqj   
       mqq> ENTRY qqqqqqqqqqqj                            
                                                          

  (B)0column-privs =                   
                                   
   qqqwqwqwq> UPDATE qqqqqwqwqqwqq>
      x x mq> REFERENCES qj x  x   
      x mqqqqqqq , <qqqqqqqqj  x   
      mqqqwq> ALL PRIVILEGES qwj   
          mq> ENTRY qqqqqqqqqqj    

  (B)0module-privs =                                         
                                                         
  qwqqwqwq> ALTER qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqwqwqqwqq>
   x  x tq> DBCTRL qqqqqqqqqqqqqqqqqqqqqqqqqqqqqu x  x   
   x  x tq> DROP qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu x  x   
   x  x tq> EXECUTE qqqqqqqqqqqqqqqqqqqqqqqqqqqqu x  x   
   x  x tq> REFERENCES qqqqqqqqqqqqqqqqqqqqqqqqqu x  x
   x  x mq> SHOW qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x  x   
   x  mqqqqqqqqqqqqqqqqqqq , <qqqqqqqqqqqqqqqqqqqqj  x   
   mqqwqqq> ALL PRIVILEGES qqqqqwqqqqqqqqqqqqqqqqqqqqj   
      mqqq> ENTRY qqqqqqqqqqqqqqj

  (B)0ext-routine-privs =                                    
                                                         
  qwqqwqwq> ALTER qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqwqwqqwqq>
   x  x tq> DBCTRL qqqqqqqqqqqqqqqqqqqqqqqqqqqqqu x  x   
   x  x tq> DROP qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu x  x   
   x  x tq> EXECUTE qqqqqqqqqqqqqqqqqqqqqqqqqqqqu x  x   
   x  x tq> REFERENCES qqqqqqqqqqqqqqqqqqqqqqqqqu x  x   
   x  x mq> SHOW qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x  x   
   x  mqqqqqqqqqqqqqqqqqqq , <qqqqqqqqqqqqqqqqqqqqj  x   
   mqqwqqq> ALL PRIVILEGES qqqwqqqqqqqqqqqqqqqqqqqqqqj   
      mqqq> ENTRY qqqqqqqqqqqqj                         

  (B)0sequence-privs =

  qwqwqwq> ALTER qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqwqwqqwqq>
   x x tq> DBCTRL qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu x  x
   x x tq> DROP qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu x  x
   x x tq> REFERENCES qqqqqqqqqqqqqqqqqqqqqqqqqqu x  x
   x x tq> SELECT qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu x  x
   x x mq> SHOW qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x  x
   x mqqqqqqq , <qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj  x
   mqq> ALL PRIVILEGES qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

  (B)0revoke-from =

  qq> FROM qqwqqwq> identifier qqqwqwqqqqqqqqqqqqqqqqqqqqqqqqqqqwwqqqqqq>  
             x  mq> PUBLIC qqqqqqqj tq> AFTER wq> identifier qqqux         
             x                      x         mq> PUBLIC qqqqqqqux         
             x                      mq> POSITION <n> qqqqqqqqqqqjx         
             mqqqqqqqqqqqqqqqqqqqqqq , <qqqqqqqqqqqqqqqqqqqqqqqqqj         

  (B)0identifier =                          
                                        
  qqwqwq> user-identifier qqqqwqwq>     
    x tq> general-identifier qu x       
    x tq> system-identifier  qu x       
    x mq> role-name qqqqqqqqqqj x 
    mqqqqqqqqqqqq + <qqqqqqqqqqqj       

3  –  Arguments

3.1  –  AFTER

    Syntax options:

       AFTER identifier
       AFTER PUBLIC

    Specifies the position of the entry within the ACL. If you omit
    the AFTER or POSITION argument, SQL searches the entire ACL
    for an identifier list that matches the one specified in the
    FROM clause of the REVOKE statement. If it finds a match, it
    modifies the ACL entry by deleting the privileges specified in
    the privilege list. If there is no match, SQL generates an error
    and the REVOKE statement has no effect on the ACL.

    With the AFTER or POSITION argument, you can specify the position
    in the list from which SQL searches for an ACL entry with an
    identifier that matches the one specified in the FROM clause of
    the REVOKE statement.

    o  In the AFTER argument, the identifier specifies the entry in
       the ACL after which SQL begins its search for the entry to be
       modified or deleted. If none of the entries in the ACL has an
       identifier that matches the identifier specified in the AFTER
       argument, SQL generates an error and the statement fails.

       Starting after the entry specified by the identifier in the
       AFTER argument, SQL searches entries in the ACL. If an entry
       has an identifier that matches the identifier specified by the
       FROM clause of the REVOKE statement, SQL modifies or deletes
       that ACL entry.

       If none of the entries has an identifier that matches the
       identifier specified by the FROM clause of the REVOKE
       statement, SQL generates an error and the statement fails
       (even if an entry before the position at which SQL began its
       search had an identifier that matched).

       Specifying PUBLIC is equivalent to a wildcard specification of
       all user identifiers.

    o  In the POSITION argument, the integer specifies the earliest
       relative position in the ACL of the entry to be modified or
       deleted. If the integer is larger than the number of entries
       in the ACL, SQL generates an error and the statement fails.

       Starting with the position specified by the POSITION argument,
       SQL searches entries in the ACL. If an entry has an identifier
       that matches the identifier specified by the FROM clause of
       the REVOKE statement, SQL modifies or deletes that ACL entry.

       If none of the entries has an identifier that matches the
       identifier specified by the FROM clause of the REVOKE
       statement, SQL generates an error and the statement fails
       (even if an entry before the position at which SQL began its
       search had an identifier that matched).

3.2  –  ALL_PRIVILEGES

    Specifies that SQL should revoke all privileges in the ACL entry.
    The REVOKE ALL PRIVILEGES statement differs from the REVOKE ENTRY
    statement in that it does not delete the entire entry from the
    ACL. The identifier remains, but without any privileges. An empty
    ACL entry denies all access to users matching the identifier,
    even if an entry later in the ACL grants PUBLIC access.

3.3  –  ENTRY

    Deletes the entire entry in the ACL, including the identifier.

3.4  –  FROM

    Syntax options:

       FROM identifier
       FROM PUBLIC

    Specifies the identifiers for the ACL entry to be modified
    or deleted. Specifying PUBLIC is equivalent to a wildcard
    specification of all user identifiers.

    You can specify foyr types of identifiers:

    o  User identifiers

    o  General identifiers

    o  System-defined identifiers

    o  Role names

    You can specify more than one identifier by combining them
    with plus signs (+).  Such identifiers are called  multiple
    identifiers. They identify only those users who are common to all
    the groups defined by the individual identifiers. Users who do
    not match all the identifiers are not controlled by that entry.

    For instance, the multiple identifier SECRETARIES + INTERACTIVE
    specifies only members of the group defined by the general
    identifier SECRETARIES that are interactive processes. It does
    not identify members of the SECRETARIES group that are not
    interactive processes.

    For more information about identifiers, see your operating system
    documentation.

3.5  –  general-identifier

    Identifies groups of users on the system and are defined by the
    OpenVMS system manager in the system privileges database. The
    following are possible general identifiers:

    o  DATAENTRY

    o  SECRETARIES

    o  MANAGERS

3.6  –  ON object-type

    Syntax options:

       ON DATABASE alias
       ON TABLE table-name
       ON COLUMN column-name
       ON MODULE module-name
       ON FUNCTION ext-routine-name
       ON PROCEDURE ext-routine-name
       ON SEQUENCE sequence-name

 Specifies whether the REVOKE statement applies to ACLs for database
 objects. You can specify a list of names for any form of the ON
 clause. You must qualify a column name with at least the associated
 table name.

3.7  –  POSITION n

    Specifies the position of the entry within the ACL. If you omit
    the AFTER or POSITION argument, SQL searches the entire ACL
    for an identifier list that matches the one specified in the
    FROM clause of the REVOKE statement. If it finds a match, it
    modifies the ACL entry by deleting the privileges specified in
    the privilege list. If there is no match, SQL generates an error
    and the REVOKE statement has no effect on the ACL.

    With the AFTER or POSITION argument, you can specify the position
    in the list from which SQL searches for an ACL entry with an
    identifier that matches the one specified in the FROM clause of
    the REVOKE statement.

    o  In the AFTER argument, the identifier specifies the entry in
       the ACL after which SQL begins its search for the entry to be
       modified or deleted. If none of the entries in the ACL has an
       identifier that matches the identifier specified in the AFTER
       argument, SQL generates an error and the statement fails.

       Starting after the entry specified by the identifier in the
       AFTER argument, SQL searches entries in the ACL. If an entry
       has an identifier that matches the identifier specified by the
       FROM clause of the REVOKE statement, SQL modifies or deletes
       that ACL entry.

       If none of the entries has an identifier that matches the
       identifier specified by the FROM clause of the REVOKE
       statement, SQL generates an error and the statement fails
       (even if an entry before the position at which SQL began its
       search had an identifier that matched).

       Specifying PUBLIC is equivalent to a wildcard specification of
       all user identifiers.

    o  In the POSITION argument, the integer specifies the earliest
       relative position in the ACL of the entry to be modified or
       deleted. If the integer is larger than the number of entries
       in the ACL, SQL generates an error and the statement fails.

       Starting with the position specified by the POSITION argument,
       SQL searches entries in the ACL. If an entry has an identifier
       that matches the identifier specified by the FROM clause of
       the REVOKE statement, SQL modifies or deletes that ACL entry.

       If none of the entries has an identifier that matches the
       identifier specified by the FROM clause of the REVOKE
       statement, SQL generates an error and the statement fails
       (even if an entry before the position at which SQL began its
       search had an identifier that matched).

3.8  –  privileges

    Types of privileges:

       db-privs
       table-privs
       column-privs
       module-privs
       ext-routine-privs
       sequence-privs

    Specifies the list of privileges you want to remove from an
    existing ACL entry. The operations permitted by a given privilege
    keyword differ, depending on whether it was granted for a
    database, table, column, module, external routine, or sequence.
    The Privileges table in the GRANT statement help topic lists
    the privilege keywords and their meanings for databases, tables,
    modules, columns, external routines, and sequences.

3.9  –  role-name

    The name of a role, such as one created with the CREATE ROLE
    statement. If the role name exists as an operating system group
    or rights identifier, then Oracle Rdb will create the role
    automatically when you issue the GRANT statement. A role that
    is created automatically always has the attribute of IDENTIFIED
    EXTERNALLY.

3.10  –  system-identifier

    Automatically defined by the OpenVMS system when the rights
    database is created at system installation time. System-defined
    identifiers are assigned depending on the type of login you
    execute. The following are all valid system-defined identifiers:

    o  BATCH

    o  NETWORK

    o  INTERACTIVE

    o  LOCAL

    o  DIALUP

    o  REMOTE

3.11  –  user-identifier

    Uniquely identifies each user on the system.

    The user identifier consists of the standard OpenVMS user
    identification code (UIC), a group name, and a member name (user
    name). The group name is optional. The user identifier can be
    in either numeric or alphanumeric format. The following are all
    valid user identifiers that could identify the same user:

       K_JONES
       [SYSTEM3, K_JONES]
       [341,311]

    You can use the asterisk (*)  wildcard character as part of a
    user identifier. For example, if you want to specify all users
    in a group on an OpenVMS system, you can enter [341,*] as the
    identifier.

    When Oracle Rdb creates a database, it automatically creates an
    ACL entry with the identifier [*,*], which grants all privileges
    except DBCTRL to any user.

    You cannot use more than one user identifier in a multiple
    identifier.

4  –  Example

    Example 1: Using REVOKE to manage user access to the database and
    tables

    SQL> attach 'filename DB$:MF_PERSONNEL';
    SQL>
    SQL> -- examine current privileges
    SQL> show protection on database RDB$DBHANDLE;
    Protection on Alias RDB$DBHANDLE
        (IDENTIFIER=SQLNET4RDB,ACCESS=SELECT+INSERT+UPDATE+DELETE+SHOW+CREATE+ALTER+
          DROP+DBCTRL+OPERATOR+DBADM+SECURITY+DISTRIBTRAN)
        (IDENTIFIER=[DOC,DOC_READER],ACCESS=SELECT+CREATE)
        (IDENTIFIER=[DOC,DOC_WRITER],ACCESS=SELECT+INSERT+UPDATE+DELETE+SHOW+CREATE+
          ALTER+DROP+DBCTRL+OPERATOR+DBADM+REFERENCES)
        (IDENTIFIER=[*,*],ACCESS=SELECT+INSERT+UPDATE+DELETE+SHOW+CREATE+ALTER+DROP+
          OPERATOR+DBADM+REFERENCES)
    SQL>
    SQL> -- revoke selected privileges
    SQL> revoke CREATE on database alias RDB$DBHANDLE from DOC_WRITER;
    SQL> revoke DISTRIBTRAN on database alias RDB$DBHANDLE from DOC_REVIEWER;
    SQL> show protection on database RDB$DBHANDLE;
    Protection on Alias RDB$DBHANDLE
        (IDENTIFIER=SQLNET4RDB,ACCESS=SELECT+INSERT+UPDATE+DELETE+SHOW+CREATE+ALTER+
          DROP+DBCTRL+OPERATOR+DBADM+SECURITY+DISTRIBTRAN)
        (IDENTIFIER=[DOC,DOC_READER],ACCESS=SELECT)
        (IDENTIFIER=[DOC,DOC_WRITER],ACCESS=SELECT+INSERT+UPDATE+DELETE+SHOW+ALTER+
          DROP+DBCTRL+OPERATOR+DBADM+REFERENCES)
        (IDENTIFIER=[*,*],ACCESS=SELECT+INSERT+UPDATE+DELETE+SHOW+CREATE+ALTER+DROP+
          OPERATOR+DBADM+REFERENCES)
    SQL>
    SQL> -- No longer all access to DOC_REVIEWER, use wildcard for all tables
    SQL> revoke ALL PRIVILEGES on table * from DOC_REVIEWER;
    SQL> commit;

    Example 2: Revoking DROP Sequence Privileges from a User

    SQL> CREATE SEQUENCE EMPID;
    SQL> SHOW PROTECTION ON SEQUENCE EMPID
    Protection on Sequence EMPID
        (IDENTIFIER=[RDB,STUART],ACCESS=SELECT+SHOW+ALTER+DROP+DBCTRL)
        (IDENTIFIER=[*,*],ACCESS=NONE)
    SQL> GRANT SELECT ON SEQUENCE EMPID TO PUBLIC;
    SQL> SHOW PROTECTION ON SEQUENCE EMPID;
    Protection on Sequence EMPID
        (IDENTIFIER=[RDB,STUART],ACCESS=SELECT+SHOW+ALTER+DROP+DBCTRL)
        (IDENTIFIER=[*,*],ACCESS=SELECT)
    SQL> REVOKE DROP ON SEQUENCE EMPID FROM STUART;
    SQL> SHOW PROTECTION ON SEQUENCE EMPID;
    Protection on Sequence EMPID
        (IDENTIFIER=[RDB,STUART],ACCESS=SELECT+SHOW+ALTER+DBCTRL)
        (IDENTIFIER=[*,*],ACCESS=SELECT)
Close Help