GRANT (sequence privileges)

This form of the GRANT statement grants privileges on a user-defined sequence.

Syntax

Read syntax diagram
          .-,-------------.                   .-,-------------.   
          V               |                   V               |   
>>-GRANT----+-ALTER-----+-+----ON SEQUENCE------sequence-name-+-->
            |       (1) |                                         
            '-USAGE-----'                                         

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

Notes:
  1. The keyword SELECT is an alternative keyword for USAGE.

Description

ALTER
Grants the privilege to alter a sequence or record a comment on a sequence.
USAGE
Grants the USAGE privilege to use a sequence. This privilege is needed when the NEXT VALUE or PREVIOUS VALUE expression is invoked for a sequence name.
SEQUENCE sequence-name
Identifies the sequence. The name, including the implicit or explicit schema qualifier, must uniquely identify an existing sequence at the current server. If no sequence by this name exists in the explicitly or implicitly specified schema, an error occurs. sequence-name must not be the name of an internal sequence object that is used by DB2®.
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.

Examples

Example 1: Grant USAGE privilege on sequence MYNUM to user JONES.
   GRANT USAGE
     ON SEQUENCE MYNUM
     TO JONES;
Example 2: Grant USAGE privileges on sequence ORDER_SEQ to role ROLE1:
   GRANT USAGE ON SEQUENCE ORDER_SEQ TO ROLE ROLE1;