GRANT statement (sequence privileges)

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

Syntax for GRANT (sequence privileges)

Read syntax diagramSkip visual syntax diagram GRANT ,ALTERUSAGE1 ON SEQUENCE ,sequence-name TO ,authorization-nameROLErole-namePUBLIC WITH GRANT OPTION
Notes:
  • 1 The keyword SELECT is an alternative keyword for USAGE.

Description for GRANT (sequence privileges)

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 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 (sequence privileges)

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;