11.8.1 Granting access privileges to an HADB user
To grant access privileges for a schema object to other HADB users, execute the GRANT statement.
- Important
-
The HADB user who grants access privileges to other users (that is, the HADB user who executes the GRANT statement) needs to have the grant options for those access privileges.
The following examples explain how to grant access privileges to other HADB users.
- Example 1:
-
In this example, the SELECT, INSERT, and EXPORT TABLE privileges for table A.T1 are granted to HADB users ADBUSER01 and ADBUSER02.
GRANT SELECT,INSERT,EXPORT TABLE ON "A"."T1" TO "ADBUSER01","ADBUSER02"
The HADB user who executes the GRANT statement needs to have the SELECT, INSERT, and EXPORT TABLE privileges with the grant options for table A.T1.
- Example 2:
-
In this example, all access privileges for table A.T1 are granted to HADB user ADBUSER01.
GRANT ALL PRIVILEGES ON "A"."T1" TO "ADBUSER01"
The HADB user who executes the GRANT statement needs to have all access privileges with the grant options for table A.T1.
- Note
-
If the HADB user who executes the GRANT statement has grant options for only a part of access privileges for table A.T1, executing the preceding GRANT statement grants only the access privileges corresponding to those grant options. For example, if the HADB user who executes the GRANT statement has only the grant options for the SELECT and INSERT privileges, executing the preceding GRANT statement grants only the SELECT and INSERT privileges to HADB user ADBUSER01.
- Example 3:
-
In this example, the SELECT privilege for table A.T1 is granted to all HADB users.
GRANT SELECT ON "A"."T1" TO PUBLIC
The HADB user who executes the GRANT statement needs to be the owner of table A.T1.
- Example 4:
-
In this example, the SELECT privilege with the grant option for table A.T1 is granted to HADB user ADBUSER01.
GRANT SELECT ON "A"."T1" TO "ADBUSER01" WITH GRANT OPTION
To grant the access privilege with the grant option, specify WITH GRANT OPTION.
The HADB user who executes the GRANT statement needs to have the SELECT privilege with the grant option for table A.T1.
For details about the GRANT statement, see GRANT (grant privileges) in Definition SQL in the manual HADB SQL Reference.