Constant value expression¶
The constant value expression holds a constant literal that refers to a fixed value that is used directly in a query and does not change during operations.
Syntax¶
- constant_value_expression
constant_value_expression ::=
literal
Parameters¶
literal¶
The constant literal. literal supports literals of multiple data types as shown below.
- Numeric literal
- Boolean literal
- Character string literal
- Temporal literal
- List literal
- Record literal
- Vector literal
- Null
For more information, see Data types and Literals.
Examples¶
'''
RETURN
1 AS num1,
3.4 AS num2,
true AS bool1,
"str literal" AS str1,
DATE '2024-01-01' AS temporal1,
DURATION ({years:1, months:2}) AS duration1,
LIST [2,3,4] AS list1,
{a:1, b:true, c:"str literal"} AS record1,
VECTOR<3, FLOAT>([1.0, 2.0, 3.0]) AS v1,
NULL AS null1
'''
Return:
+------+------+-------+-------------+------------+-----------+---------+------------------------------+---------------+-------+
| num1 | num2 | bool1 | str1 | temporal1 | duration1 | list1 | record1 | v1 | null1 |
+------+------+-------+-------------+------------+-----------+---------+------------------------------+---------------+-------+
| 1 | 3.4 | true | str literal | 2024-01-01 | P1Y2M | [2,3,4] | {a:1,b:true,c:"str literal"} | [1.0,2.0,3.0] | null |
+------+------+-------+-------------+------------+-----------+---------+------------------------------+---------------+-------+