Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

System Functions

Reference of the SQL system functions supported by GridGain — CASEWHEN, CAST, COALESCE, CONVERT, DECODE, GREATEST, IFNULL, LEAST, NULLIF, NVL2, and TABLE.

CASEWHEN

Description

Returns 'aValue' if the Boolean expression is true, 'bValue' otherwise.

GridGain supports a more powerful CASE WHEN expression.

CASEWHEN (boolean , aValue , bValue)

Parameters

  • boolean - the value to evaluate

  • aValue - the value to return if Boolean is true

  • bValue - value to return if Boolean is false

Example

Evaluate the ID and return the corresponding value:

CASEWHEN(ID=1, 'A', 'B')

CAST

Description

Converts a value to another data type using one the following conversion rules:

  • When converting a number to a Boolean, 0 is considered falseand any other value is consideredtrue`

  • When converting a Boolean to a number, false is 0 and true is 1

  • When converting a number to a number of another type, the value is checked for overflow

  • When converting a number to a binary type, the number of bytes matches the precision

  • When converting a string to a binary type, it is hex-encoded

  • A hex string can be converted to the binary type and then to a number; if a direct conversion is not possible, the value is first converted to a string

Parameters

  • value - the value to convert

  • dataType - the data type to convert the value to

Examples

COALESCE | NVL

Description

Returns the first value that is not NULL.

Parameters

aValue, bValue - values to process

Example

Return the first non-null value out of A, B, and C:

CONVERT

Description

Converts a value to another data type.

Parameters

  • value - the value to convert

  • dataType - the data type to convert the value to

Example

Convert NAME to an integer:

DECODE

Description

Returns the first matching value. NULL matches NULL. If no match is found, NULL or the last parameter is returned (if the parameter count is even).

Parameters

  • value - the value to match against

  • whenValue, thenValue, etc. - values to check

Example

Return the first value that matches random number greater than 0.5:

GREATEST

Description

Returns the greatest value that is not NULL, or NULL if all values are NULL.

Parameters

aValue, bValue - values to process

Example

Return the greatest values out of 1, 2, and 3:

IFNULL

Description

Returns 'a' if the value is not NULL, 'b' otherwise.

Parameters

aValue, bValue - values to process

Example

Check NULL and space ('') for being NULL:

LEAST

Description

Returns the smallest value that is not NULL, or NULL if all values are NULL.

Parameters

Example

NULLIF

Description

Returns NULL if 'a' equals 'b', otherwise returns 'a'.

Parameters

aValue, bValue - values to process

Example

Check if A=B:

NVL2

Description

If the test value is NULL, returns 'bValue'. Otherwise, returns 'aValue'. The data type of the returned value is the same as that of 'aValue'.

Parameters

  • testValue - the value to test for NULL

  • aValue - the value to return if testVale is not NULL

  • bValue - the value to return if testVale is NULL

Example

Test if X is NULL:

TABLE | TABLE_DISTINCT

Description

Returns the result set that matches the criteria. TABLE_DISTINCT removes duplicate rows.

Parameters

  • name - the table name

  • dataType - the data type to return

  • expression - the expression that defines the dataType

Example

Return everything from the table:

This page is: Copyright © 2026 MariaDB. All rights reserved.

Last updated

Was this helpful?