Oracle® TimesTen In-Memory Database SQL Reference Release 11.2.1 Part Number E13070-04 |
|
|
View PDF |
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.
SQL syntax
GRANT {SystemPrivilege [,...] | ALL [PRIVILEGES]} [...] TO {user |PUBLIC} [,...] GRANT {{ObjectPrivilege [,...] | ALL [PRIVILEGES]} ON {[owner.]object}[,...]} TO {user | PUBLIC} [,...]
Parameters
Granting system privileges:
Parameter | Description |
---|---|
SystemPrivilege |
See "System privileges" for a list of acceptable values. |
ALL [PRIVILEGES] |
Assigns all system privileges to the user. |
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 CREATE USER statement. |
PUBLIC |
Specifies that the privilege is granted to all users. |
Granting object privileges:
Parameter | Description |
---|---|
ObjectPrivilege |
See "Object privileges" for a list of acceptable values. |
ALL [PRIVILEGES] |
Assigns all object privileges to the user. |
[ owner .] object |
object is the name of the object on which privileges are being granted. owner is the owner of the object. If owner is not specified, then the user who is granting the privilege is assumed to be the owner. |
user |
Name of the user to whom privileges are being granted. The user must exist in the database. |
PUBLIC |
Specifies that the privilege is granted to all users. |
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.
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