GRANT statement (variable privileges)

This form of the GRANT statement grants privileges on global variables.

Syntax for GRANT (variable privileges)

Read syntax diagramSkip visual syntax diagramGRANT ALLPRIVILEGES,READWRITE ONVARIABLEvariable-name TO,authorization-nameROLErole-namePUBLIC WITH GRANT OPTION

Description for GRANT (variable privileges)

ALL PRIVILEGES
Grants both READ and WRITE privileges on the specified global variable.
READ
Grants the privilege to access the content of the specified global variable.
WRITE
Grants the privilege to modify the content of the specified global variable.
ON VARIABLE variable-name
Identifies the global variable for which you are granting privileges. variable-name, including an implicit or explicit qualifier, must identify a global variable that exists at the current server.
TO
Refer to GRANT statement for a description of the TO clause.
WITH GRANT OPTION
Refer to GRANT statement for a description of the WITH GRANT OPTION clause.

Examples for GRANT (variable privileges)

Example 1: Grant the read privilege on the ACCOUNTNO variable on the current server to user Jones:
GRANT READ ON VARIABLE ACCOUNTNO TO JONES;