Syntax to revoke privileges on specific tables and views
- Last Updated: March 30, 2020
- 2 minute read
- OpenEdge
- Version 12.2
- Documentation
The syntax to revoke privileges on specific tables and views is shown below:
Syntax
|
Parameters
- GRANT OPTION FOR
-
Revokes the
GRANToption for the privilege from the specified users. The actual privilege itself is not revoked. If specified withRESTRICT, and the privilege is passed on to other users, theREVOKEstatement fails and generates an error. Otherwise,GRANT OPTION FORimplicitly revokes any privilege the user might have provided to other users. - privilege
-
The syntax for the
privilegeitem is shown below:{ SELECT | INSERT | DELETE | INDEX | UPDATE [ ( column , column , ... ) ] | REFERENCES [ ( column , column , ... ) ]} ; - privilege [ , privilege] , ...| ALL [ PRIVILEGES ]
-
List of privileges to be revoked. Refer to the description in the
GRANTstatement. RevokingRESOURCEandDBAprivileges can only be done by the administrator or a user withDBAprivileges.If more than one user grants access to the same table to a user, then all the grantors must perform a revoke for the user to lose access to the table.
Using the keyword
ALLrevokes all the privileges granted on the table or view. - FROM PUBLIC
-
Revokes the specified privileges on the table or view from any user with access to the system.
- RESTRICT | CASCADE
-
Prompts SQL to check to see if the privilege being revoked was passed on to other users. If the original privilege included the clause
WITH GRANT OPTION, then theREVOKEstatement fails and generates an error. If the privilege was not passed on, theREVOKEstatement succeeds.If the
REVOKEstatement specifiesCASCADE, revoking the access privileges from a user also revokes the privileges from all users who received the privilege from that user.If the
REVOKEstatement does not specify eitherRESTRICTnorCASCADE, the behavior follows onlyCASCADE. - GRANTED BY ANY_USER
-
A DBA can use this phrase to revoke all or specific access privileges to a table for a specified user, even if the user was the creator of the table. This phrase is only applicable to users with DBA privileges.
Examples
Revoking privileges
In the following example, REVOKE is
used on INSERT and DELETE privileges:
|
If the username specified
in a GRANT DBA or GRANT RESOURCE operation
does not already exist in the authorization tables, the GRANT statement
creates a row in the SYSDBAUTH system table for
the new username. This row is not deleted by
a subsequent REVOKE operation.
Revoking privileges from a user associated with the domain of multi-tenant table
In the following example, a DBA revokes privileges
from dbuser1 associated with domuser1 domain
of a multi-tenant table:
|
The user names dbuser1 and dbuser2 must be associated with the domain name domuser1 in the multi-tenant table.
Revoking privileges for a specified user who has been granted privileges by ANY_USER.
In this example, all privileges granted by any_user on PUB.EMPLOYEE table are revoked from bsmith:
|
In this example, only SELECT and INSERT
privileges granted by any_user on PUB.EMPLOYEE table are revoked from
bsmith:
|
For more information on SQL database user authentication and REVOKE statement, see Learn about
Identity Management.