
This form of the GRANT statement grants privileges on a global variable.
This statement can be embedded in an application program or issued interactively. It is an executable statement that can be dynamically prepared.
The privileges held by the authorization ID of the statement must include at least one of the following:
If WITH GRANT OPTION is specified, the privileges held by the authorization ID of the statement must include at least one of the following:
.-PRIVILEGES-. >>-GRANT--+-ALL--+------------+-+-------------------------------> | .-,---------. | | V | | '---+-ALTER-+-+-------' +-READ--+ '-WRITE-' .-,-------------. V | >--ON -VARIABLE----variable-name-+------------------------------> .-,----------------------. V | >--TO----+-authorization-name-+-+--+-------------------+------->< '-PUBLIC-------------' '-WITH GRANT OPTION-'
If you do not use ALL, you must use one or more of the keywords listed below. Each keyword grants the privilege described.
Corresponding System Authorities: GRANT and REVOKE statements assign and remove system authorities for SQL objects. The following table describes the system authorities that correspond to the SQL privileges:
| SQL Privilege | Corresponding System Authorities when Granting to or Revoking from a Global Variable |
|---|---|
| ALL (Grant or revoke of ALL grants or revokes only those privileges the authorization ID of the statement has) | *OBJALTER |
| ALTER | *OBJALTER |
| READ | *OBJOPR |
| WRITE | *OBJOPR |
| WITH GRANT OPTION | *OBJMGT |
Corresponding System Authorities When Checking Privileges to a Global Variable: The following table describes the system authorities that correspond to the SQL privileges when checking privileges to a global variable. The left column lists the SQL privilege. The right column lists the equivalent system authorities.
| SQL Privilege | Corresponding System Authorities |
|---|---|
| ALTER | *OBJALTER |
| READ | *OBJOPR and *EXECUTE and *READ |
| WRITE | *OBJOPR and *EXECUTE and |
Grant the READ and WRITE privileges on global variable MYSCHEMA.MYJOB_PRINTER to user ZUBIRI.
GRANT READ, WRITE ON VARIABLE MYSCHEMA.MYJOB_PRINTEER TO ZUBIRI
