An SQL comment is all text following two consecutive hyphens (--) on the same line of a static SQL statement in an application program or the command portion of a DBS Utility command.
Comments are allowed wherever a separator (space character) is valid.
identifier
>>-+-ordinary_identifier--+------------------------------------>< '-delimited_identifier-'
ordinary_identifier
.-----------------------. V | >>-uppercase_letter------+------------------+--+--------------->< +-uppercase_letter-+ +-digit------------+ '- _ --------------'
Notes:
delimited_identifier
>>-"--non_space_character---------------------------------------> >-----+----------------------------------------------+--"------>< | .------------------. | | V (1) | | '----character--------+---non_space_character--'
Notes:
A metavariable (or parameter) is a lowercase character or group of characters used in syntax diagrams to represent a group of variables.
authorization_name
With a VSE system, authorization names and passwords are limited to 8 characters and cannot have embedded blanks.
>>-short_identifier--------------------------------------------><
collection_id
>>-short_identifier--------------------------------------------><
column_name >>-+-------------------+--long_identifier---------------------->< +-table_name.-------+ +-view_name.--------+ +-synonym.----------+ '-correlation_name.-'
constraint_name >>-long_identifier---------------------------------------------><
correlation_name >>-long_identifier---------------------------------------------><
cursor_name >>-long_ordinary_identifier------------------------------------><
cursor_variable >>-long_ordinary_identifier------------------------------------><
dbspace_name >>-+--------+--short_ordinary_identifier----------------------->< '-owner.-'
descriptor_name >>-:host_identifier--------------------------------------------><
host_variable >>-:host_identifier----+----------------------------------+---->< | .-INDICATOR-. | '-+-----------+--:host_identifier--'
host_variable_list .-,----------------. V | >>----host_variable---+----------------------------------------><
index_id >>-short_ordinary_identifier-----------------------------------><
index_name >>-+--------+--long_identifier--------------------------------->< '-owner.-'
owner_name >>-short_ordinary_identifier-----------------------------------><
package_id >>-short_ordinary_identifier-----------------------------------><
package_name >>-+--------+--long_identifier--------------------------------->< '-owner.-'
package_spec >>-+----------------------------+-------------------------------> +-short_ordinary_identifier.-+ '-host_identifier.-----------' >-----+-short_ordinary_identifier-+---------------------------->< | (1) | '-host_identifier-----------'
Notes:
password >>-short_ordinary_identifier-----------------------------------><
program_name >>-short_ordinary_identifier-----------------------------------><
routine_name >>-+--------+--long_identifier--------------------------------->< '-owner.-'
section_variable >>-host_identifier---------------------------------------------><
server_name >>-long_ordinary_name------------------------------------------><
statement_name >>-long_ordinary_identifier------------------------------------><
statement_variable >>-long_ordinary_identifier------------------------------------><
subsystemid >>-short_ordinary_identifier-----------------------------------><
synonym >>-+--------+--long_identifier--------------------------------->< '-owner.-'
table_id >>-short_ordinary_identifier-----------------------------------><
table_name >>-+--------+--long_identifier--------------------------------->< '-owner.-'
view_id >>-short_ordinary_identifier-----------------------------------><
view_name >>-+--------+--long_identifier--------------------------------->< '-owner.-'
|Result Set LOCATOR
|For RESULT SET LOCATOR data. This data type is used to |identify host variables that are used by the DB2 Server for VSE & VM |requester to uniquely indicate a query result set returned by a stored |procedure.
|RESULT SET LOCATOR | | ||--+-| Assembler |-+--------------------------------------------| | +-| C |---------+ | +-| COBOL |-----+ | '-| PL/I |------' | |Assembler | ||---variable-name----+-DC-+--F----------------------------------| | '-DS-' | |C | ||---+---------+---+----------+----------------------------------> | +-auto----+ +-const----+ | +-extern--+ '-volatile-' | +-static--+ | '-_Packed-' | | .-,---------------------------------. | V | |>-----SQL TYPE IS RESULT_SET_LOCATOR VARYING-----variable-name--+--------------+--+---;-> | '-= init-value-' | |>---------------------------------------------------------------| | |COBOL | ||---01--variable-name--SQL TYPE IS RESULT-SET-LOCATOR VARYING--.--> | |>---------------------------------------------------------------| | |PL/I | ||---+-DECLARE-+---+-variable-name----------------+--------------> | '-DCL-----' | .-,----------------. | | | V | | | '-(-----variable-name---+---)--' | |>----SQL TYPE IS RESULT_SET_LOCATOR VARYING--+---------------------------------------+---;-> | '-Alignment and/or Scope and/or Storage-' | |>---------------------------------------------------------------| |
CHARacter
For character data that has a fixed number of characters (integers). The maximum number of characters is 254.
.-(1)-------. >>-CHARacter----+-----------+---------------------------------->< '-(integer)-'
DATE
A three-part value that designates a point in time according to the Gregorian calendar. Internally represented as 4-byte packed decimal. The three parts are the year, month, and day. The date can be formatted in several ways. The range of year is 0001 to 9999. The range of month is 1 to 12. The range of day is 1 to n where n depends on the month.
>>-DATE--------------------------------------------------------><
DECimal
For decimal data. The p identifies the total number of decimal digits a number can have. The s identifies the number of digits to the right of the decimal point. For example, DECIMAL(5,2) creates a decimal column consisting of five digits, two of which are to the right of the decimal point. The NUMERIC parameter is a synonym for DECIMAL.
.-(5,0)----------------------. >>-+-DECimal-+---+----------------------------+---------------->< '-NUMERIC-' | (1) | '-(--p-------+---------+--)--' | (2) | '-,s------'
Notes:
FLOAT
For floating-point numbers. Floating-point numbers range from 5.4E-79 to 7.2E+75. When integer is between 1 and 21, it is a single-precision floating-point number; REAL is a synonym for FLOAT in this situation. When integer is between 22 and 53, it is a double-precision floating-point number; DOUBLE PRECISION is a synonym for FLOAT in this situation.
.-(53)------. >>-+-FLOAT--+-----------+-+------------------------------------>< | '-(integer)-' | +-REAL-----------------+ '-DOUBLE PRECISION-----'
GRAPHIC
For double-byte character set (DBCS) data that has a fixed number of DBCS characters (integer). The maximum number of DBCS characters is 127.
.-(1)-------. >>-GRAPHIC----+-----------+------------------------------------>< '-(integer)-'
INTeger
For large positive or negative whole numbers. The largest number that can be accommodated is 2147483647; the smallest number is -2147483648.
>>-INTeger-----------------------------------------------------><
LONG VARCHAR
For character data that varies in length up to 32,767 characters.
(1) >>-LONG VARCHAR------------------------------------------------><
Notes:
LONG VARGRAPHIC
For double-byte character set (DBCS) data that varies in length. A LONG VARGRAPHIC can be up to a maximum of 16,383 DBCS characters.
(1) >>-LONG VARGRAPHIC---------------------------------------------><
Notes:
SMALLINT
For small positive or negative whole numbers. The largest number that can be accommodated is 32767; the smallest is -32768.
>>-SMALLINT----------------------------------------------------><
TIME
A three-part value in a number of formats that designates a time of day according to a 24-hour clock. Internally represented as 3-byte packed decimal. The three parts are the hour, minute, and second. The range of hour is 0 to 24, and the range of minute and second is 0 to 59.
>>-TIME--------------------------------------------------------><
TIMESTAMP
A seven-part value that designates a date and time, including a fractional part. Internally represented as 10-byte packed decimal. The seven parts are year, month, day, hour, minute, second, and microsecond.
>>-TIMESTAMP---------------------------------------------------><
VARCHAR
For character data that varies in length. The integer refers to the maximum number of characters for any entry and can be a value up to 32767. When the value is greater than 254, the data type is considered a long string.
(1) >>-VARCHAR---------(integer)-----------------------------------><
Notes:
VARGRAPHIC
For double-byte character set (DBCS) data that varies in length. The integer is the number of DBCS characters for any entry; the maximum is 16383. When integer is greater than 127, the data type is considered a long string.
(1) >>-VARGRAPHIC---------(integer)--------------------------------><
Notes:
A string representation of a date is a character string that starts
with a digit and has a length of at least 8 characters.
Format Name | Abbrev. | Date Format | Example |
---|---|---|---|
International Standards Organization | ISO | yyyy-mm-dd | 1993-12-12 |
IBM USA standard | USA | mm/dd/yyyy | 12/12/1993 |
IBM European standard | EUR | dd.mm.yyyy | 12.12.1993 |
Japanese Industrial Standard Christian Era | JIS | yyyy-mm-dd | 1993-12-12 |
Site-defined | LOCAL | Any site-defined form | -- |
A string representation of a time is a character string that starts
with a digit and has a length of at least 4 characters.
Format Name | Abbrev. | Time Format | Example |
---|---|---|---|
International Standards Organization | ISO | hh.mm.ss | 13.30.05 |
IBM USA standard | USA | hh:mm AM or PM | 1:30 PM |
IBM European standard | EUR | hh.mm.ss | 13.30.05 |
Japanese Industrial Standard Christian Era | JIS | hh:mm:ss | 13:30:05 |
Site-defined | LOCAL | Any site-defined form | -- |
Integer Constant
.----------. V | >>-+-----+------digit---+-------------------------------------->< +- + -+ '- - -'
Decimal Constant
>>-+---------+--.---+-----------------------+------------------>< '-integer-' | (1) | '-unsigned_integer------'
Notes:
Floating-Point Constant
>>--+-decimal-+--E--integer------------------------------------>< '-integer-'
Character Constant - SBCS
.----------------. V | >>-'------+-----------+--+--'---------------------------------->< '-character-'
Character Constant - MIXED
.-----------------------------------------------. V | >>-'-------+-----------------------------------------+--+--'--->< +-character-------------------------------+ | .-------------------------. | | V | | '- < -----double_byte_character--+--- > --'
Character Constant - Hexadecimal
.------------------------------. V | >>-X--'-------+-----------------------+---+--'----------------->< '-hexadecimal_character-'
Graphic Constant - in PL/I Programs
(1) >>-<'----+-------------------------------+--'G>---------------->< | .-------------------------. | | V | | '----double_byte_character---+--'
Notes:
or
(1) >>-'<----+-------------------------------+-->'G---------------->< | .-------------------------. | | V | | '----double_byte_character---+--'
Notes:
Graphic Constant - In All Other Contexts
(1) >>-G'<---------+-------------------------------+-->'----------->< | .-------------------------. | | V | | '----double_byte_character---+--'
Notes:
The following special registers are supported by the database manager.
An expression specifies a value. The form of an expression is as follows:
.-| operator |--------------------------------. V (1) | >>----+-----+---+-column_name----------+---------+------------->< +- + -+ +-constant-------------+ '- - -' +-(expression)---------+ +-function-------------+ +-host_variable--------+ +-| labeled_duration |-+ '-special_register-----' operator (2) |---+- CONCAT ------+-------------------------------------------| +- / -----------+ +- * -----------+ +- + -----------+ '- - -----------'
Notes:
labeled_duration |--+-column_name---+---+-DAY----------+-------------------------| +-constant------+ +-DAYS---------+ +-(expression)--+ +-HOUR---------+ +-function------+ +-HOURS--------+ '-host_variable-' +-MICROSECOND--+ +-MICROSECONDS-+ +-MINUTE-------+ +-MINUTES------+ +-MONTH--------+ +-MONTHS-------+ +-SECOND-------+ +-SECONDS------+ +-YEAR---------+ '-YEARS--------'
(1) (1) >>-date---------+- + -+---+-date_dur---------+------------------> '- - -' '-labeled_date_dur-' >------ = --date-----------------------------------------------><
Notes:
>>-+-date----------+-- - ----+-date----------+-- = --date_dur-->< | (1) | | (1) | '-date_str------' '-date_str------'
Notes:
(1) (1) >>-time---------+- + -+---+-time_dur---------+------------------> '- - -' '-labeled_time_dur-' >------ = --time-----------------------------------------------><
Notes:
>>-+-time----------+-- - ----+-time----------+-- = --time_dur-->< | (1) | | (1) | '-time_str------' '-time_str------'
Notes:
(1) (1) >>-timestamp---------+- + -+---+-date_dur------+----------------> '- - -' +-labeled_dur---+ +-time_dur------+ '-timestamp_dur-' >------ = --timestamp------------------------------------------><
Notes:
>>-+-timestamp----------+-- - ----+-timestamp----------+--------> | (1) | | (1) | '-timestamp_str------' '-timestamp_str------' >---- = --timestamp_dur----------------------------------------><
Notes:
Specifies a condition that is true, false, or unknown about a row or group.
>>-exp----+- = -------+---+-exp---------+---------------------->< | (1) | '-(subselect)-' +- <> ------+ +- < -------+ +- > -------+ +- <= ------+ '- >= ------'
Notes:
>>-exp--+-----+--BETWEEN--exp--AND--exp------------------------>< '-NOT-'
>>-+-----+--EXISTS----(subselect)------------------------------>< '-NOT-'
>>-exp--+-----+--IN--+-(subselect)-------------------------+--->< '-NOT-' | .-,-----------------------. | | V | | '-(----+-constant-----------+--+---)--' +-host_variable_list-+ '-special_register---'
>>-column_name---+-----+--LIKE----+-USER----------+-------------> '-NOT-' +-host_variable-+ '-str_constant--' >-----+--------------------------------+----------------------->< '-ESCAPE-+-host_variable------+--' '-character_constant-'
>>-column_name--IS--+-----+--NULL------------------------------>< '-NOT-'
>>-exp----+- = -------+---+-SOME-+---(subselect)--------------->< | (1) | +-ANY--+ +- <> ------+ '-ALL--' +- < -------+ +- > -------+ +- <= ------+ '- >= ------'
Notes:
Specifies a condition that is true, false, or unknown about a row or group. The common form of a search condition is column_name operator value. Refer to Predicate for additional functions available for search conditions.
>>-+-----+----+-predicate----------+----------------------------> '-NOT-' '-(search_condition)-' .----------------------------------------------------. V | >--------+----------------------------------------------+--+--->< '--+-AND-+--+-----+----+-predicate----------+--' '-OR--' '-NOT-' '-(search_condition)-'