The System supports these miscellaneous functions and expressions.Documentation Index
Fetch the complete documentation index at: https://docs.ocient.com/llms.txt
Use this file to discover all available pages before exploring further.
CASE
CASE operates similarly to conditional scripting in other programming languages, allowing it to function like an if / then / else statement or as a switch statement.
CASE sets one or more WHEN conditions to be evaluated. When a condition is evaluated as true, the database applies the specified action in a THEN clause. If no matches are found, the database applies the action in the ELSE clause. If no ELSE clause is specified and no matches are found, the result is NULL.
This evaluation creates a new column where the values are expressions inside the THEN clause.
Syntax
SQL
| Arguments | Description |
|---|---|
search_condition | A condition including a column name and a Boolean expression to evaluate. |
switch_expression | A column name to be used to evaluate a switch_value. |
switch_value | A value to be evaluated for the switch_expression. |
expression | An expression to return based on evaluating the search_condition or switch_expression. |
CASE to categorize individuals into different groups based on their ages.
SQL
SQL
COALESCE
Returns the first argument that is not NULL or NULL if all arguments are NULL. Arguments must be the same type, and the returned value is the most compatible type.COALESCE can work with mixed-type numeric arguments, which means the lower precedence types are cast to the highest one. For example, when using TIMESTAMP and DATE data types, all values are cast to a timestamp.
Syntax
SQL
| Argument | Data Type | Description |
|---|---|---|
value [,...] | All data types are supported. All values must be of the same type. | Values for comparison to find the value that is not NULL. |
SQL
13
COMMIT
Returns the most recent commit hash of the database to which the client is currently connected. SyntaxSQL
SQL
cd0d53e3aa
CURRENT_DATABASE
Alias for DATABASE.CURRENT_NODE
Returns the name of the SQL Node where the current query executes. The name of the node corresponds to thename column in the sys.nodes system catalog table.
Syntax
SQL
SQL
sql0
CURRENT_GROUPS
Returns the fully qualified names of groups to which the current user belongs. You can query thesys.groups system catalog table to view the group information.
Syntax
SQL
SQL
['sso_users@system', 'analysts@system']
CURRENT_NODE_ID
Returns the identifier of the SQL Node where the current query executes. The name of the node corresponds to theid column in the sys.nodes system catalog table.
Syntax
SQL
SQL
f690c14a-4e4f-4143-8e5e-20c90b60e15c
CURRENT_SCHEMA
Returns the name of the current schema. SyntaxSQL
SQL
schema@database
CURRENT_SESSION_ID
Returns the identifier of the current session as a Universally Unique IDentifier (UUID) that matches theid column in the sys.sessions system catalog table.
Syntax
SQL
SQL
6ffe8383-e894-44c0-91c5-38d5925f51ec
CURRENT_SYSTEM
Returns the name of the system. You can set the name using the ALTER SYSTEM RENAME TO SQL statement.If you never set the system name, the Ocient System initializes the name of the system as a random identifier, the UUID.
SQL
SQL
2677b88c-7f07-470c-be3e-e1bafddc1221
CURRENT_USER
Returns the user for the current connection. SyntaxSQL
SQL
user@database
DATABASE
Alias for CURRENT_DATABASE. Returns the name of the database to which the client is currently connected. SyntaxSQL
SQL
test
GREATEST
Returns the largest non-NULL value of all the arguments, or NULL if all the arguments are NULL. All values must be comparable to each other. SyntaxSQL
| Argument | Data Type | Description |
|---|---|---|
value [,...] | All data types are supported. All values must either be of the same type or comparable to each other. | A series of values to compare to find the largest value of the set. |
SQL
13
IF_NULL
Returns the first argument that is not NULL or NULL if all arguments are NULL. Arguments must be the same type, and the returned value is the most compatible type.IF_NULL can work with mixed-type numeric arguments, which means the lower precedence types are cast to the highest one. For example, when using TIMESTAMP and DATE data types, all values are cast to a timestamp.
Syntax
SQL
| Argument | Data Type | Description |
|---|---|---|
value [,...] | All data types are supported. All values must be of the same type. | Values for comparison to find the value that is not NULL. |
SQL
5
LEAST
Returns the smallest non-NULL value of all arguments, or NULL if all arguments are NULL. All values must be comparable to each other. SyntaxSQL
| Argument | Data Type | Description |
|---|---|---|
value [,...] | All data types are supported. All values must either be of the same type or comparable to each other. | A series of values to compare to find the smallest value of the set. |
SQL
5
MURMUR3
Returns a 32-bit MurmurHash3 hash of the input value as an INTEGER data type. If you specify a NULL input value, the function returns 0. This function is primarily useful for partitioning data. SyntaxSQL
| Argument | Data Type | Description |
|---|---|---|
value | All SQL data types are supported. | Specified value for the MurmurHash3 hash function. |
SQL
0
Example
SQL
331477181
NULL_IF
Returns the NULL value if two arguments are equal; otherwise, returns the first argument. SyntaxSQL
SQL
13
Example
SQL
NULL
RAND_UUID
Alias for UUID_GENERATE.SHOW
TheSHOW function lets you explore the database and its metadata for user-defined items. For details, see Information Schema.
Syntax
SQL
SQL
SQL
SQL
SQL
UUID_GENERATE
Alias for RAND_UUID. Generates a random UUID value (version 4). For details about the UUID data type, see Data Types. SyntaxSQL
SQL
3f6b2b58-4c9a-4a32-9b6a-b2f9b8e2a41e
TYPE_STRIP
Returns the SQL type of the specified value. SyntaxSQL
| Argument | Data Type | Description |
|---|---|---|
value | All data types are supported. | Specified value for the determination of the type. You can specify columns, literals, and expressions. |
SQL
MATRIX[1][3]
SQL
CHAR
SQL
NULL
SQL
INT[]
VERSION
Returns the version of the database to which the client is currently connected. SyntaxSQL
SQL
22.0.0-20230105.2353
ZN
Ifx is NULL, returns 0. Otherwise, returns x.
Syntax
SQL
SQL
0
Example
SQL
12

