GRANT
The GRANT
statement assigns one or more privileges to a user.
Required privilege
ADMIN
to grant system privileges.
ADMIN
or the object owner to grant object privileges.
Usage with TimesTen Scaleout
This statement is supported with TimesTen Scaleout.
SQL syntax
GRANT {SystemPrivilege [,...] | ALL [PRIVILEGES]} [...] TO {user |PUBLIC} [,...]
or
GRANT {{ObjectPrivilege [,...] | ALL [PRIVILEGES]} ON {[Owner.]object}[,...]} TO {user | PUBLIC} [,...]
Parameters
The following parameters are for granting system privileges:
Parameter | Description |
---|---|
|
This is the system privilege to grant. See "System Privileges" for a list of acceptable values. |
|
Assigns all system privileges to the user. |
|
Name of the user to whom privileges are being granted. The user name must first have been introduced to the TimesTen database by a |
|
Specifies that the privilege is granted to all users. |
The following parameters are for granting object privileges:
Parameter | Description |
---|---|
|
This is the object privilege to grant. See "Object Privileges" for a list of acceptable values. |
|
Assigns all object privileges to the user. |
|
|
|
Name of the user to whom privileges are being granted. The user must exist in the database. |
|
Specifies that the privilege is granted to all users. |
Description
-
One or more system privileges can be granted to a user by a user with
ADMIN
privilege. -
One or more object privileges can be granted to a user by the owner of the object.
-
One or more object privileges can be granted to a user on any object by a user with
ADMIN
privilege. -
To remove a privilege from a user, use the
REVOKE
statement. -
You cannot grant system privileges and object privileges in the same statement.
-
Only one object can be specified in an object privilege statement.
-
When replication is configured, this statement is replicated.
Examples
Grant the ADMIN
privilege to the user terry
:
GRANT admin TO terry;
Assuming the grantor has ADMIN
privilege, grant the SELECT
privilege to user terry
on the customers
table owned by user pat
:
GRANT SELECT ON pat.customers TO terry;
Grant an object privilege to user terry
:
GRANT SELECT ON emp_details_view TO terry;
See also