4.1. Expressions

    Description of Expression Elements

    Column name

    Identifier of a column from a specified table used in evaluations or as a search condition. A column of the array type cannot be an element in an expression except when used with the predicate.

    Array element

    An expression may contain a reference to an array member i.e., <array_name>[*s*], where s is the subscript of the member in the array <array_name>

    Arithmetic operators

    The +, -, *, / characters used to calculate values

    Concatenation operator

    The || (“double-pipe”) operator used to concatenate strings

    Logical operators

    The reserved words NOT, AND and OR, used to combine simple search conditions in order to create complex assertions

    Comparison operators

    The symbols =, <>, !=, ~=, , <, <=, >, >=, !<, ~<, ^<, !>, ~> and ^>

    LIKE, STARTING WITH, CONTAINING, SIMILAR TO, BETWEEN, and IS [NOT] DISTINCT FROM

    Existential predicates

    Predicates used to check the existence of values in a set. The IN predicate can be used both with sets of comma-separated constants and with subqueries that return a single column. The EXISTS, SINGULAR, ALL, ANY and SOME predicates can be used only with subqueries.

    Constant

    A number or a string literal enclosed in apostrophes

    Date/time literal

    An expression, similar to a string literal enclosed in apostrophes, that can be interpreted as a date, time or timestamp value. Date literals can be predefined literals ('TODAY', 'NOW', etc.) or strings of characters and numerals, such as '25.12.2016 15:30:35', that can be resolved as date and/or time strings.

    Context variable

    An internally-defined context variable

    Local variable

    Declared local variable, input or output parameter of a PSQL module (stored procedure, trigger, unnamed PSQL block in DSQL)

    Positional parameter

    A member of in an ordered group of one or more unnamed parameters passed to a stored procedure or prepared query

    A SELECT statement enclosed in parentheses that returns a single (scalar) value or, when used in existential predicates, a set of values

    Function identifier

    The identifier of an internal or external function in a function expression

    Type cast

    An expression explicitly converting data of one data type to another using the CAST function ( CAST (<value> AS <datatype>) ). For date/time literals only, the shorthand syntax <datatype> <value> is also supported (DATE '2016-12-25').

    Conditional expression

    Expressions using CASE and related internal functions

    Parentheses

    Bracket pairs (…​) used to group expressions. Operations inside the parentheses are performed before operations outside them. When nested parentheses are used, the most deeply nested expressions are evaluated first and then the evaluations move outward through the levels of nesting.

    COLLATE clause

    Clause applied to CHAR and VARCHAR types to specify the character-set-specific collation sequence to use in string comparisons

    Expression for obtaining the next value of a specified generator (sequence). The internal GEN_ID() function does the same.