4.4.20 Constant
(1) Format
constant::={character-string-constant|numeric-constant}
character-string-constant::={date-data|time-data|
timestamp-data|character-string}
numeric-constant::={integer-constant|floating-point-constant|decimal-constant}
(2) Function
Specifies a constant. You can specify one or more values.
(3) Operands
character-string-constant
Specifies date data, time data, timestamp data, or a character string. The data type is VARCHAR.
- date-data
- For details about specifying date data, see 3.2.6(2) Character string showing dates.
- time-data
- For details about specifying time data, see 3.2.6(3) Character string showing time.
- timestamp-data
- For details about specifying timestamp data, see 3.2.6(4) Character string showing timestamp data.
- character-string
- For details about specifying character strings, see 3.2.6(1) Constant types and notation.
numeric-constant
Specifies an integer constant, floating-point constant, or decimal constant.
- integer-constant
- If an integer constant ends with the character L or l, the data type becomes BIGINT. If only a number is specified, the data type becomes INTEGER.
- For details about specifying an integer constant, see 3.2.6(1) Constant types and notation.
- floating-point-constant
- The data type of a floating-point constant is DOUBLE.
- For details about specifying a floating-point constant, see 3.2.6(1) Constant types and notation.
- decimal-constant
- The data type of a decimal constant is DECIMAL or NUMERIC.
- For details about specifying a decimal constant, see 3.2.6(1) Constant types and notation.
(4) Syntax rules
(5) Notes
- There are no escape characters for character strings. If a tab is inserted in a character string or if a new line is entered, that character code is embedded into the character string constant.
- A floating-point constant that overflows does not cause an error. The value becomes infinity.
- A decimal constant that is outside the allowable range for the DECIMAL type (NUMERIC type) does not cause an error. The value is expressed as a value described in CQL.
(6) Usage example
Outputs the result obtained by adding -5.3 to the value of column a in relation s1 and multiplying column b by 4. The underlined part indicates a constant.
REGISTER QUERY q1 SELECT -5.3+s1.a AS xxx, 4*s1.b AS xxy FROM s1[ROWS 100];