SQL/MX 2.x Reference Manual (H06.04+)

SQL/MX Language Elements
HP NonStop SQL/MX Reference Manual540440-003
6-37
Expressions
Expressions
An SQL value expression, referred to as an expression, can evaluate to a value with
one of these:
The data type of an expression is the data type of the value of the expression.
A value expression can be, among other things, a character string literal, a numeric
literal, a host variable, a dynamic parameter, or a column name that specifies the value
of the column in a row of a table. A value expression can also include, among other
operands, functions and scalar subqueries.
Character Value Expressions
The operands of a character value expression—referred to as character primaries—
can be combined with the concatenation operator (||). The data type of a character
primary is character string.
Character Value Expressions
on page 6-37
Operands can be combined with the concatenation
operator (||). Example: 'HOUSTON,' ||' TEXAS'
Datetime Value Expressions
on
page 6-39
Operands can be combined in specific ways with
arithmetic operators.
Example: CURRENT_DATE + INTERVAL '1' DAY
Interval Value Expressions
on
page 6-43
Operands can be combined in specific ways with addition
and subtraction operators.
Example: INTERVAL '2' YEAR
- INTERVAL '3' MONTH
Numeric Value Expressions
on
page 6-48
Operands can be combined in specific ways with
arithmetic operators. Example: SALARY * 1.10
Rowset Expressions
on
page 6-51
Operands can be combined to form rowset expressions.
character-expression is:
character-primary
| character-expression || character-primary
character-primary is:
character-string-literal
| column-reference
| character-type-host-variable
| dynamic parameter
| character-value-function
| aggregate-function
| sequence-function
| scalar-subquery
| CASE-expression
| CAST-expression
| (character-expression)