GRANT statement (type or JAR file privileges)

This form of the GRANT statement grants the privilege to use distinct types, array types, or JAR files.

Syntax for GRANT (type or JAR file privileges)

Read syntax diagramSkip visual syntax diagramGRANTUSAGE ONTYPE,type-nameJAR,jar-nameTO ,authorization-nameROLErole-namePUBLIC WITH GRANT OPTION

Description for GRANT (type or JAR file privileges)

USAGE
Grants the privilege to use the distinct type in tables, functions procedures, or the privilege to use the JAR file.
TYPE type-name
Identifies the user-defined type. The name, including the implicit or explicit schema name, must identify a unique user-defined type that exists at the current server.
JAR jar-name
Identifies the JAR file. The name, including the implicit or explicit schema name, must identify a unique JAR file 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.

Notes for GRANT (type or JAR file privileges)

Alternative syntax and synonyms: To provide compatibility with previous releases of Db2 or other products in the Db2 family, Db2 supports DATA TYPE or DISTINCT TYPE as a synonym for TYPE.

Examples for GRANT (type or JAR file privileges)

Example 1: Grant the USAGE privilege on distinct type SHOE_SIZE to user JONES. This GRANT statement does not give JONES the privilege to execute the cast functions that are associated with the distinct type SHOE_SIZE.
   GRANT USAGE ON TYPE SHOE_SIZE TO JONES;
Example 2: Grant the USAGE privilege on distinct type US_DOLLAR to all users at the current server.
   GRANT USAGE ON TYPE US_DOLLAR TO PUBLIC;
Example 3: Grant the USAGE privilege on distinct type CANADIAN_DOLLAR to the administrative assistant (ADMIN_A), and give this user the ability to grant the USAGE privilege on the distinct type to others. The administrative assistant cannot grant the privilege to execute the cast functions that are associated with the distinct type CANADIAN_DOLLAR because WITH GRANT OPTION does not give the administrative assistant the EXECUTE authority on these cast functions.
   GRANT USAGE ON TYPE CANADIAN_DOLLAR TO ADMIN_A
         WITH GRANT OPTION;
Example 4: Grant the USAGE privilege on the distinct type MILES to role ROLE1 at the current server:
GRANT USAGE ON TYPE MILES
    TO ROLE ROLE1;