SQL functions and operators
ReOrc's semantic layer translates user-defined queries into the SQL dialect of your underlying data source. However, due to differences in SQL syntax and the need for query transformation, certain SQL functions and operators may not be fully supported—particularly within query fragments that perform SELECT
operations directly from tables.
To ensure compatibility and consistent behavior, ReOrc provides a defined set of supported SQL functions and expressions. Below is the list of currently supported functions:
<
Returns TRUE if the first value is less than the second
>
Returns TRUE if the first value is greater than the second
<=
Returns TRUE if the first value is less than or equal to the second
>=
Returns TRUE if the first value is greater than or equal to the second
=
Returns TRUE if the first value is equal to the second
<> or !=
Returns TRUE if the first value is not equal to the second
ABS
Absolute value
CEIL
Nearest integer greater than or equal to argument
DEGREES
Converts radians to degrees
EXP
Exponential (e raised to the given power)
FLOOR
Nearest integer less than or equal to argument
LN
Natural logarithm
LOG
Base 10 logarithm
LOG10
Base 10 logarithm (same as LOG)
PI
Approximate value of π
POWER
a raised to the power of b
RADIANS
Converts degrees to radians
ROUND
Rounds v to s decimal places
SIGN
Sign of the argument (-1, 0, or +1)
SQRT
Square root
TRUNC
Truncates to integer (towards zero)
ACOS
Inverse cosine, result in radians
ASIN
Inverse sine, result in radians
ATAN
Inverse tangent, result in radians
ATAN2
Inverse tangent of y/x, result in radians
COS
Cosine, argument in radians
COT
Cotangent, argument in radians
SIN
Sine, argument in radians
TAN
Tangent, argument in radians
||
Concatenates two strings
BTRIM
Removes characters from start and end of string
BIT_LENGTH
Returns number of bits in the string
CHAR_LENGTH
Returns number of characters in the string
LOWER
Converts the string to all lower case
LTRIM
Removes characters from the start of string
OCTET_LENGTH
Returns number of bytes in the string
POSITION
Returns index of substring within string
RTRIM
Removes characters from the end of string
SUBSTRING
Extracts the substring of string
TRIM
Removes characters from start, end, or both ends
UPPER
Converts the string to all upper case
ASCII
Returns the numeric code of the first character
CONCAT
Concatenates all arguments
LEFT
Returns first n characters (or all but last ABS(n))
REPEAT
Repeats string the specified number of times
REPLACE
Replaces all occurrences of a substring
RIGHT
Returns last n characters (or all but first ABS(n))
STARTS_WITH
Returns TRUE if string starts with prefix
LIKE
Returns TRUE if the string matches the pattern
REGEXP_SUBSTR
Returns substring matching regex pattern
TO_CHAR
Converts timestamp to string by format
DATE_ADD
Adds interval to a timestamp
DATE_TRUNC
Truncates timestamp to specified precision
DATEDIFF
Difference between date parts of expressions
EXTRACT
Retrieves subfields like year or hour
LOCALTIMESTAMP
Returns current date and time without time zone
NOW
Returns current date and time with time zone
CASE
Generic conditional expression
COALESCE
Returns the first non-NULL argument
NULLIF
Returns NULL if arguments are equal
GREATEST
Selects the largest value
LEAST
Selects the smallest value
AVG
Average of non-NULL input values
COUNT
Counts non-NULL input rows
COUNT(DISTINCT)
Counts unique non-NULL input values
MAX
Maximum of non-NULL input values
MIN
Minimum of non-NULL input values
SUM
Sum of non-NULL input values
MEASURE
Works with measures of any type
COVAR_POP
Population covariance
COVAR_SAMP
Sample covariance
STDDEV_POP
Population standard deviation
STDDEV_SAMP
Sample standard deviation
VAR_POP
Population variance
VAR_SAMP
Sample variance
IN
TRUE if value matches any from a list
NOT IN
TRUE if value matches none from a list
Last updated