GRANT (type or JAR file privileges)

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

Syntax

Read syntax diagram
                                .-,------------------.     
                                V                    |     
>>-GRANT----USAGE ON----+-TYPE----distinct-type-name-+-+-------->
                        |      .-,--------.            |   
                        |      V          |            |   
                        '-JAR----jar-name-+------------'   

       .-,----------------------.                          
       V                        |                          
>--TO----+-authorization-name-+-+--+-------------------+-------><
         +-ROLE--role-name----+    '-WITH GRANT OPTION-'   
         '-PUBLIC-------------'                            

Description

USAGE
Grants the privilege to use the distinct type in tables, functions procedures, or the privilege to use the JAR file.
TYPE distinct-type-name
Identifies the distinct type. The name, including the implicit or explicit schema name, must identify a unique distinct 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 for a description of the TO clause.
WITH GRANT OPTION
Refer to GRANT for a description of the WITH GRANT OPTION clause.

Notes

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

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;