Reserved words

Keywords can be used as ordinary identifiers, except in a context where they could also be interpreted as SQL syntax. When a keyword can be interpreted as SQL syntax the keyword is considered a reserved word in that context, which means that it cannot be used as an ordinary identifier.

However, a keyword can be used as an identifier in a context where it is a reserved word, by specifying it as a delimited identifier. For example:

  • ALL cannot be a column name in a SELECT statement, unless it is delimited. However, if the quotation mark (") is the escape character that begins and ends delimited identifiers, “ALL” can be used as a column name in a SELECT statement.
  • COUNT cannot be used as a column name in a SELECT statement, unless it is also specified as delimited.

New reserved words for Db2 12 are identified by note 1 in the following list. Some topics in this information might also indicate words that cannot be used in the specific context that is being described.

IBM® SQL has additional reserved words that Db2 for z/OS® does not enforce. Therefore, you should not use these additional reserved words as ordinary identifiers in names that have a continuing use. See IBM Db2 SQL Reference for Cross-Platform Development for a list of the words.

Begin general-use programming interface information.

A
  • ADD
  • AFTER
  • ALL
  • ALLOCATE
  • ALLOW
  • ALTERAND
  • ANY
  • AS
  • ARRAY
  • ARRAY_EXISTS
  • ASENSITIVE
  • ASSOCIATE
  • ASUTIME
  • AT
  • AUDIT
  • AUX
  • AUXILIARY
B
  • BEFORE
  • BEGIN
  • BETWEEN
  • BUFFERPOOL
  • BY
C
  • CALL
  • CAPTURE
  • CASCADED
  • CASE
  • CAST
  • CCSID
  • CHAR
  • CHARACTER
  • CHECK
  • CLONE
  • CLOSE
  • CLUSTER
  • COLLECTION
  • COLLID
  • COLUMN
  • COMMENT
  • COMMIT
  • CONCAT
  • CONDITION
  • CONNECT
  • CONNECTION
  • CONSTRAINT
  • CONTAINS
  • CONTENT
  • CONTINUE
  • CREATE
  • CUBE
  • CURRENT
  • CURRENT_DATE
  • CURRENT_LC_CTYPE
  • CURRENT_PATH
  • CURRENT_SCHEMA
  • Start of changeFL 504 CURRENT_SERVER1End of change
  • CURRENT_TIME
  • CURRENT_TIMESTAMP
  • Start of changeFL 504 CURRENT_TIMEZONE1End of change
  • CURRVAL
  • CURSOR
D
  • DATA
  • DATABASE
  • DAY
  • DAYS
  • DBINFO
  • DECLARE
  • DEFAULT
  • DELETE
  • DESCRIPTOR
  • DETERMINISTIC
  • DISABLE
  • DISALLOW
  • DISTINCT
  • DO
  • DOCUMENT
  • DOUBLE
  • DROP
  • DSSIZE
  • DYNAMIC
E
  • EDITPROC
  • ELSE
  • ELSEIF
  • ENCODING
  • ENCRYPTION
  • END
  • ENDING
  • END-EXEC2
  • ERASE
  • ESCAPE
  • EXCEPT
  • EXCEPTION
  • EXECUTE
  • EXISTS
  • EXIT
  • EXPLAIN
  • EXTERNAL
F
  • FENCED
  • FETCH
  • FIELDPROC
  • FINAL
  • FIRST
  • FOR
  • FREE
  • FROM
  • FULL
  • FUNCTION
G
  • GENERATED
  • GET
  • GLOBAL
  • GO
  • GOTO
  • GRANT
  • GROUP
H
  • HANDLER
  • HAVING
  • HOLD
  • HOUR
  • HOURS
I
  • IF
  • IMMEDIATE
  • IN
  • INCLUSIVE
  • INDEX
  • INHERIT
  • INNER
  • INOUT
  • INSENSITIVE
  • INSERT
  • INTERSECT
  • INTO
  • IS
  • ISOBID
  • ITERATE
J
  • JAR
  • JOIN
K
  • KEEP
  • KEY
L
  • LABEL
  • LANGUAGE
  • LAST
  • LC_CTYPE
  • LEAVE
  • LEFT
  • LIKE
  • Start of changeLIMIT1End of change
  • LOCAL
  • LOCALE
  • LOCATOR
  • LOCATORS
  • LOCK
  • LOCKMAX
  • LOCKSIZE
  • LONG
  • LOOP
M
  • MAINTAINED
  • MATERIALIZED
  • MICROSECOND
  • MICROSECONDS
  • MINUTEMINUTES
  • MODIFIES
  • MONTH
  • MONTHS
N
  • NEXT
  • NEXTVAL
  • NO
  • NONE
  • NOT
  • NULL
  • NULLS
  • NUMPARTS
O
  • OBID
  • OF
  • Start of changeOFFSET1End of change
  • OLD
  • ON
  • OPEN
  • OPTIMIZATION
  • OPTIMIZE
  • OR
  • ORDER
  • ORGANIZATION
  • OUT
  • OUTER
P
  • PACKAGE
  • PARAMETER
  • PART
  • PADDED
  • PARTITION
  • PARTITIONED
  • PARTITIONING
  • PATH
  • PIECESIZE
  • PERIOD
  • PLAN
  • PRECISION
  • PREPARE
  • PREVVAL
  • PRIOR
  • PRIQTY
  • PRIVILEGES
  • PROCEDURE
  • PROGRAM
  • PSID
  • PUBLIC
Q
  • QUERY
  • QUERYNO
R
  • READS
  • REFERENCES
  • REFRESH
  • RESIGNAL
  • RELEASE
  • RENAME
  • REPEAT
  • RESTRICT
  • RESULT
  • RESULT_SET_LOCATOR
  • RETURN
  • RETURNS
  • REVOKE
  • RIGHT
  • ROLE
  • ROLLBACK
  • ROLLUP
  • ROUND_CEILING
  • ROUND_DOWN
  • ROUND_FLOOR
  • ROUND_HALF_DOWN
  • ROUND_HALF_EVEN
  • ROUND_HALF_UP
  • ROUND_UP
  • ROW
  • ROWSET
  • RUN
S
  • SAVEPOINT
  • SCHEMA
  • SCRATCHPAD
  • SECOND
  • SECONDS
  • SECQTY
  • SECURITY
  • SEQUENCE
  • SELECT
  • SENSITIVE
  • SESSION_USER
  • SET
  • SIGNAL
  • SIMPLE
  • SOME
  • SOURCE
  • SPECIFIC
  • STANDARD
  • STATIC
  • STATEMENT
  • STAY
  • STOGROUP
  • STORES
  • STYLE
  • SUMMARY
  • SYNONYM
  • SYSDATE
  • SYSTEM
  • SYSTIMESTAMP
T
  • TABLE
  • TABLESPACE
  • THEN
  • TO
  • TRIGGER
  • TRUNCATE
  • TYPE
U
  • UNDO
  • UNION
  • UNIQUE
  • UNTIL
  • UPDATE
  • USER
  • USING
V
  • VALIDPROC
  • VALUE
  • VALUES
  • VARIABLE
  • VARIANT
  • VCAT
  • VERSIONING
  • VIEW
  • VOLATILE
  • VOLUMES
W
  • WHEN
  • WHENEVER
  • WHERE
  • WHILE
  • WITH
  • WLM
X
  • XMLEXISTS
  • XMLNAMESPACES
  • XMLCAST
Y
  • YEAR
  • YEARS
Z
  • ZONE
Notes:
  1. New reserved word for Db2 12.
  2. COBOL only

End general-use programming interface information.