3. Assigning Privileges and Granting Permissions : Object Permissions : Working with Grants : The GRANT Statement
 
Share this page                  
The GRANT Statement
The GRANT statement is used to grant permissions. This statement has the general form:
GRANT privilege ON object TO whom
The full syntax of a GRANT statement is:
GRANT ALL [PRIVILEGES] | privilege {, privilege}
   [ON [object_type] [schema.]object_name {, [schema.]object_name}]
   TO PUBLIC | [authorization_type] auth_id {, auth_id} [WITH GRANT OPTION];
The default object type is TABLE, which is used for any table or view. The default authorization type is USER.
Authorization identifiers specify who is receiving the permissions. Authorizations can be specified for:
Individual users
Permissions defined by a particular GRANT statement can be issued to one or more end users, specifying the login user identifier.
The key word PUBLIC, which includes all users. The authorization type PUBLIC is not followed by any auth_ids.
For example: Grant all query permissions for the games table to all sessions:
GRANT ALL ON games TO PUBLIC;
A defined group
A defined role
Authorizations for the individual user and PUBLIC are always in effect but can be adjusted by group and role permissions.
For complete information on the GRANT statement, see the SQL Reference Guide.