Expression
caseExpression
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
caseExpression_start((START))
caseExpression_start --> caseExpression_0_0[CASE]
caseExpression_0_0 --> caseExpression_0_0a[expression]
caseExpression_0_0 --> caseExpression_0_1[caseWhenThenExpression]
caseExpression_0_0a --> caseExpression_0_1
caseExpression_0_1 --> caseExpression_0_2[caseElseExpression]
caseExpression_0_2 --> caseExpression_0_3[END]
caseExpression_0_3 --> caseExpression_end((END))
Purpose
Evaluates to an expression, testing a number of boolean expressions in sequence for true. When no boolean expression evaluates to true, the else expression is returned.
With an expression directly after case, the simple form, each when holds a value instead of a condition, and the first when whose value equals the expression is taken: case x when 1 then 'a' when 2 then 'b' else 'c' end is case when x = 1 then 'a' when x = 2 then 'b' else 'c' end. The values are compared as the comparison operator = compares them, so a null expression or a null value matches no when and the else expression, or null without one, is returned. The expression is evaluated for each when. The simple form is available from release 28.0.
caseWhenThenExpression
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
caseWhenThenExpression_start((START))
caseWhenThenExpression_start --> caseWhenThenExpression_0_0[WHEN]
caseWhenThenExpression_0_0 --> caseWhenThenExpression_0_1[expression]
caseWhenThenExpression_0_1 --> caseWhenThenExpression_0_2[THEN]:::quoted
caseWhenThenExpression_0_2 --> caseWhenThenExpression_0_3[expression]
caseWhenThenExpression_0_3 --> caseWhenThenExpression_end((END))
caseElseExpression
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
caseElseExpression_start((START))
caseElseExpression_start --> caseElseExpression_0_0[ELSE]
caseElseExpression_0_0 --> caseElseExpression_0_1[expression]
caseElseExpression_0_1 --> caseElseExpression_end((END))
castExpression
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
castExpression_start((START))
castExpression_start --> castExpression_0_0[CAST]
castExpression_0_0 --> castExpression_0_1["("]
castExpression_0_1 --> castExpression_0_2[expression]
castExpression_0_2 --> castExpression_0_3[AS]
castExpression_0_3 --> castExpression_0_4[sqlDataTypeExtended]
castExpression_0_4 --> castExpression_0_5[")"]
castExpression_0_5 --> castExpression_end((END))
Purpose
Changes the data type of an expression into the indicated data type.
not
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> not
not -->| | NOT
NOT --> End((END))
Purpose
Not is a unary operator which returns true when the condition is false and false when it is true. When the condition is null, the outcome is null, so neither the condition nor its not selects the row.
is
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> is
is -->| | IS
IS --> End((END))
are
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> are
are -->| | ARE
ARE --> End((END))
and
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> and
and -->| | AND
AND --> End((END))
Purpose
And is a binary operator which returns true when both conditions are true and false when at least one of them is false, whatever the other is. Otherwise, when one is null and the other true or null, the outcome is null: null and false is false, null and true is null. A where clause selects only the rows for which the outcome is true, so there null and false select alike, but a select list, a comparison of conditions such as (a > 0 and b > 0) = false, coalesce and is null tell them apart. Up to and including release 27.0, a comparison with a null value of a column and an and with an operand that is null answered false outside a where clause.
or
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> or
or -->| | OR
OR --> End((END))
Purpose
Or is a binary operator which returns true when at least one of both conditions is true, whatever the other is, and false when both are false. Otherwise, when one is null and the other false or null, the outcome is null: null or true is true, null or false is null. Up to and including release 27.0, an or with an operand that is null answered false outside a where clause, so that select x > 0 or y > 0 answered false where x and y were null.
true
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> true
true -->| | TRUE
TRUE --> End((END))
false
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> false
false -->| | FALSE
FALSE --> End((END))
parameterExpression
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
parameterExpression_start((START))
parameterExpression_start --> parameterExpression_0_0[COLON]
parameterExpression_0_0 --> parameterExpression_0_1[identifier]
parameterExpression_0_1 --> parameterExpression_end((END))
gt
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> gt
gt -->| | GT
GT --> End((END))
Purpose
Greater then is a binary operator which returns true when the left value is greater than the right value. When one of both values is null, the outcome is null. Otherwise it is false.
ge
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> ge
ge -->| | GE
GE --> End((END))
Purpose
Greater or equal is a binary operator which returns true when the left value is greater than or equal to the right value. When one of both values is null, the outcome is null. Otherwise it is false.
lt
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> lt
lt -->| | LT
LT --> End((END))
Purpose
Less then is a binary operator which returns true when the left value is less than the right value. When one of both values is null, the outcome is null. Otherwise it is false.
le
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> le
le -->| | LE
LE --> End((END))
Purpose
Less or equal is a binary operator which returns true when the left value is less than or equal to the right value. When one of both values is null, the outcome is null. Otherwise it is false.
eq
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> eq
eq -->| | EQ
EQ --> End((END))
Purpose
Equals is a binary operator which returns true when the left value and right value are identical. When one of both values is null, the outcome is null.
neq
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> neq
neq -->| | NEQ
NEQ --> End((END))
Purpose
Not equals is a binary operator which returns true when the left value and right value are not identical. When one of both values is null, the outcome is null.
like
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> like
like -->| | LIKE
LIKE --> End((END))
Purpose
Like is an operator which returns true when the left value matches the pattern on the right. A % in the pattern matches a sequence of zero, one or more characters, and a _ matches exactly one character. Without escape, every % and _ in the pattern is a wildcard.
With escape followed by a text of exactly one character, that character makes the %, _ or escape character directly after it stand for itself: code like 'A!_%' escape '!' selects the codes starting with A_, and '10%' like '10!%' escape '!' is true. An escape character followed by any other character, or at the end of the pattern, raises itgensql921. An escape that is not exactly one character long raises itgensql920, and a pattern that is not a text raises itgensql922. The escape clause is available from release 28.0.
When the value, the pattern or the escape is null, neither like nor not like is true, so neither selects the row. Up to and including release 27.0, not like without escape could select the rows with a null value, depending on the platform.
A like or not like with escape whose pattern is a constant without an escaped % or _ is handed to the platform as the same like or not like without escape characters, and as an equality when the pattern holds no wildcard at all. For a like whose pattern has an escaped % or _, the platform receives a wider like in which each escaped % or _ is replaced by _; Invantive UniversalSQL then removes the rows that do not match exactly, and a delete or update with such a condition is executed row by row. A not like with an escaped % or _ is evaluated by Invantive UniversalSQL itself, so all rows that the other conditions select are retrieved from the platform first.
Examples
The following example selects the codes that start with A_; without escape the pattern 'A_%' would also select AB1 and A%2:
select cde.code
from ( select 'A_1' code from dual@datadictionary
union all
select 'AB1' code from dual@datadictionary
union all
select 'A%2' code from dual@datadictionary
) cde
where cde.code like 'A!_%' escape '!'
code
----
A_1
between
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> between
between -->| | BETWEEN
BETWEEN --> End((END))
Purpose
Between is a tertiary operator which returns true when the left value has a value between the second and third values, including edges: x between a and b is x >= a and x <= b. When the left value is null, the outcome is null. When one bound is null, the outcome is null unless the other bound already decides it: 5 between null and 3 is false, so 5 not between null and 3 is true. Texts are compared by the code of each character (ordinal), as in order by. Up to and including release 27.0.79, not between with a null bound could select other rows.
in_
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> in_
in_ -->| | IN
IN --> End((END))
Purpose
In is a n-ary operator which returns true when the left value is one of the right-hand side values after the 'in'. When the left value is null, or when no value matches and one of the values is null, the outcome is null, so neither in nor not in selects the row: 1 not in (2, null) is null. Up to and including release 27.0.79, not in with a null among the values could select the row.
When there are no values at all, which happens when a subquery returns no rows, in is false and not in is true, also when the left value is null: there is no value for it to be unequal to. Up to and including release 27.0.79, not in with a null left value against a correlated subquery that returned no rows could answer null instead, for example inside a case or under an or.
Examples
The following example selects every employee, because the subquery returns no rows; the employee without a department is selected as well:
select emp.code
from ( select 'A100' code, 'SLS' dept
union all
select 'A200' code, null dept
) emp
where emp.dept not in ( select dpt.dept
from ( select 'ENG' dept
) dpt
where dpt.dept = 'FIN'
)
code
----
A100
A200
expression
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart TD
expression_start((START))
expression_start --> expression_0_0[minus]
expression_0_0 --> expression_0_1[plus]
expression_0_1 --> expression_0_2[not]
expression_0_2 --> expression_0_3[expression]
expression_0_3 --> expression_end((END))
expression_start --> expression_1_0[expression]
expression_1_0 --> expression_1_1[concat]
expression_1_1 --> expression_1_2[times]
expression_1_2 --> expression_1_3[divide]
expression_1_3 --> expression_1_4[plus]
expression_1_4 --> expression_1_5[minus]
expression_1_5 --> expression_1_6[gt]
expression_1_6 --> expression_1_7[ge]
expression_1_7 --> expression_1_8[lt]
expression_1_8 --> expression_1_9[le]
expression_1_9 --> expression_1_10[eq]
expression_1_10 --> expression_1_11[neq]
expression_1_11 --> expression_1_12[and]
expression_1_12 --> expression_1_13[or]
expression_1_13 --> expression_1_14[expression]
expression_1_14 --> expression_1_15[not]
expression_1_15 --> expression_1_16[like]
expression_1_16 --> expression_1_17[between]
expression_1_17 --> expression_1_18[expression]
expression_1_18 --> expression_1_19[and]
expression_1_19 --> expression_1_20[expression]
expression_1_20 --> expression_1_21[in_]
expression_1_21 --> expression_1_22["("]
expression_1_22 --> expression_1_23[expression]
expression_1_23 --> expression_1_24[","]:::quoted
expression_1_24 --> expression_1_25[expression]
expression_1_25 --> expression_1_26[selectStatement]
expression_1_26 --> expression_1_27[")"]
expression_1_27 --> expression_1_28[is]
expression_1_28 --> expression_1_29[not]
expression_1_29 --> expression_1_30[NULL]
expression_1_30 --> expression_end((END))
expression_start --> expression_2_0[not]
expression_2_0 --> expression_2_1[exists]
expression_2_1 --> expression_2_2["("]
expression_2_2 --> expression_2_3[selectStatement]
expression_2_3 --> expression_2_4["("]
expression_2_4 --> expression_2_5[selectStatement]
expression_2_5 --> expression_2_6[expression]
expression_2_6 --> expression_2_7[")"]
expression_2_7 --> expression_end((END))
expression_start --> expression_3_0[constantExpression]
expression_3_0 --> expression_end((END))
expression_start --> expression_4_0[functionExpression]
expression_4_0 --> expression_end((END))
expression_start --> expression_5_0[parameterExpression]
expression_5_0 --> expression_end((END))
expression_start --> expression_6_0[triggerRecordVariableExpression]
expression_6_0 --> expression_end((END))
expression_start --> expression_7_0[castExpression]
expression_7_0 --> expression_end((END))
expression_start --> expression_8_0[caseExpression]
expression_8_0 --> expression_end((END))
expression_start --> expression_9_0[arrayExpression]
expression_9_0 --> expression_end((END))
expression_start --> expression_10_0[pSqlCallProcedureStatementNS]
expression_10_0 --> expression_end((END))
expression_start --> expression_11_0[fieldIdentifier]
expression_11_0 --> expression_end((END))
expression_start --> expression_12_0[bindVariable]
expression_12_0 --> expression_end((END))
expression_start --> expression_13_0[aggregateFunction]
expression_13_0 --> expression_end((END))
bindVariable
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> bindVariable
bindVariable -->| | BIND_VARIABLE
BIND_VARIABLE --> End((END))
arrayExpression
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
arrayExpression_start((START))
arrayExpression_start --> arrayExpression_0_0[ARRAY_OPEN]
arrayExpression_0_0 --> arrayExpression_0_1[expression]
arrayExpression_0_1 --> arrayExpression_0_2[","]:::quoted
arrayExpression_0_2 --> arrayExpression_0_3[expression]
arrayExpression_0_3 --> arrayExpression_0_4[ARRAY_CLOSE]
arrayExpression_0_4 --> arrayExpression_end((END))
functionExpression
A functionExpression is one of the following SQL functions:
LIST
WHERE file.folder = "Invantive UniversalSQL/Grammar/SQL Functions"
AND file.name != this.file.name
SORT file.name ASC
divide
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> divide
divide -->| | DIVIDE
DIVIDE --> End((END))
Purpose
Divide one number by the second number.
Parameters:
- first: a number to divide.
- second: a number to divide with.
Returns: the divided output.
exists
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> exists
exists -->| | EXISTS
EXISTS --> End((END))
ln
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> ln
ln -->| | LN
LN --> End((END))
Purpose
The LN function gets the natural logarithm of a number.
Parameters:
- Input: a number to get the natural logarithm from.
Returns: the natural logarithm of the input.
minus
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> minus
minus -->| | MINUS
MINUS --> End((END))
Purpose
The MINUS functions subtracts a value from another.
Parameters:
- Value: a number or datetime.
- Subtract: a number or datetime.
Returns: the value minus the subtraction.
plus
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> plus
plus -->| | PLUS
PLUS --> End((END))
Purpose
The PLUS function adds a value to another.
Parameters:
- Value: a number or datetime.
- add: a number or datetime.
Returns: A new value with both values added to eachother.
times
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> times
times -->| | ASTERIX
ASTERIX --> End((END))
Purpose
The TIMES function multiplies one number by the second number.
Parameters:
- First: a number to multiply.
- Second: a number to multiply with.
Returns: the first number multiplied by the second number.
constantExpression
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> constantExpression
constantExpression -->| | stringLiteral
stringLiteral --> End((END))
constantExpression -->| | numericConstant
numericConstant --> End((END))
constantExpression -->| | booleanConstant
booleanConstant --> End((END))
constantExpression -->| | intervalConstant
intervalConstant --> End((END))
constantExpression -->| | datetimeLiteral
datetimeLiteral --> End((END))
constantExpression -->| | null
null --> End((END))
stringConstant
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
stringConstant_start((START))
stringConstant_start --> stringConstant_0_0[stringOrChar]
stringConstant_0_0 --> stringConstant_0_1[CONCAT_OP]
stringConstant_0_1 --> stringConstant_0_2[stringOrChar]
stringConstant_0_2 --> stringConstant_end((END))
Purpose
A constant text value with varchar2 data type, made of one or more literals joined by ||. Used where a statement requires a constant, such as a label, a name or a delimiter.
stringLiteral
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> stringOrChar
stringOrChar --> End((END))
Purpose
A single text literal within an expression. Literals joined by || in an expression are a concatenation and yield the same value as the constant made of those literals: 'a' || 'b' is 'ab', and '' || '' is null. A concatenation counts one level per || towards the maximum nesting of a statement, so a single expression joins at most about 990 literals; a longer one is refused with itgendid801.
stringOrChar
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> STRING_C
STRING_C --> parenthesisOpen
parenthesisOpen --> INT_OR_DECIMAL_C
INT_OR_DECIMAL_C --> parenthesisClose
parenthesisClose --> STRING_C
STRING_C --> End((END))
intervalConstant
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
intervalConstant_start((START))
intervalConstant_start --> intervalConstant_0_0[INTERVAL]
intervalConstant_0_0 --> intervalConstant_0_1[stringConstant]
intervalConstant_0_1 --> intervalConstant_end((END))
Purpose
A constant interval value, reflecting the time span between two dates. The text constant consists of an integer number and unit of time, taken from the following list:
- Millisecond,
- second,
- minute,
- hour,
- day,
- week, and
- year.
The units may be postfixed with an 's' without changing meaning, like 'years'.
Valid interval values are for example: "5 seconds", "20 hours" and "1 year". There is no support for combined intervals such as "30 minutes and 30 seconds".
datetimeLiteral
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
datetimeLiteral_start((START))
datetimeLiteral_start --> datetimeLiteral_0_0[DATE]:::quoted
datetimeLiteral_start --> datetimeLiteral_0_0a[TIME]:::quoted
datetimeLiteral_start --> datetimeLiteral_0_0b[TIMESTAMP]:::quoted
datetimeLiteral_0_0 --> datetimeLiteral_0_1[stringLiteral]
datetimeLiteral_0_0a --> datetimeLiteral_0_1
datetimeLiteral_0_0b --> datetimeLiteral_0_1
datetimeLiteral_0_1 --> datetimeLiteral_end((END))
Purpose
A constant date, time or timestamp in the notation of the SQL standard, which means the same in every language and culture: date '2026-08-13', time '12:34:56' or timestamp '2026-08-13 12:34:56.123456'. A date is written as YYYY-MM-DD, a time as HH24:MI:SS and a timestamp as YYYY-MM-DD HH24:MI:SS; the seconds may have up to seven decimals, and a timestamp without a time of day is midnight. A text in any other notation, or a date that does not exist such as date '2026-02-30', raises an error. The value is the same as a cast of the text gives, such as cast('2026-08-13' as date). Available from release 28.0.
numericConstant
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> numericConstant
numericConstant -->| | INT_OR_DECIMAL_C
INT_OR_DECIMAL_C --> End((END))
numericConstant -->| | E_NOTATION_C
E_NOTATION_C --> End((END))
Purpose
A constant numeric value with numeric data type.
booleanConstant
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> booleanConstant
booleanConstant -->| | true
true --> End((END))
booleanConstant -->| | false
false --> End((END))