PL/SQL>SQL>Data Control Language

Data Control Language(grant,revoke)

      DCL commands are used for granting and revoking the permissions.

GRANT

This is used to grant the privileges to other users.

Syntax:
      Grant privileges on object_name to user_name [with grant option];

Example:
      SQL> grant select on Graduates to Adiya; -- you can give individual privilege
      SQL> grant select, insert on Graduates to Adiya; -- you can give set of privileges
      SQL> grant all on Graduates to Adiya; -- you can give all privileges

      The Adiya user has to use dot method to access the object.

      SQL> select * from Aahil.Graduates;

      The Adiya user can not grant permission on Graduates table to other users. To get this type of option use the following.

      SQL> grant all on Graduates to Adiya with grant option;

      Now Adiya user also grant permissions on Graduates table.

REVOKE

This can be used to add or remove columns and to modify the precision of the datatype.

This is used to revoke the privileges from the users to which you granted the privileges.

Syntax:
      Revoke privileges> on object_name from user_name;

Example:
      SQL> revoke select on Graduates form Adiya; -- you can revoke individual privilege
      SQL> revoke select, insert on Graduates from Adiya; -- you can revoke set of privileges
      SQL> revoke all on Graduates from Adiya; -- you can revoke all privileges

Go Back