Skip to content
Developer Edition runs on one host and does not require a product license file. Need multi-host deployment or performance testing at scale? Explore Enterprise Edition

Function value expression

The function value expression holds a function instance and returns the execution result of the function.

Syntax

function_value_expression
function_name ( value_expression , ) function_name ()

function_value_expression ::=
    function_name '(' value_expression ( ',' value_expression )* ')'
  | function_name '()'

Parameters

function_name

The name of a function. For more information, see Functions.

value_expression

An expression that returns a value used as the argument of a function. For more information, see Value expressions.

Examples

Use the function abs()

The function abs() returns the absolute value of a number.

RETURN abs(-32.4) AS f1

Return:

+------+
| f1   |
+------+
| 32.4 |
+------+

Use the function substring()

The function substring() returns a substring of a string.

RETURN substring("abc", 1, 1) AS f2

Return:

+----+
| f2 |
+----+
| a  |
+----+

Use multiple function expressions

RETURN abs(-32.4) AS f1, substring("abc", 1, 1) AS f2

Return:

+------+----+
| f1   | f2 |
+------+----+
| 32.4 | a  |
+------+----+

Use functions without arguments

RETURN date() AS currentDate

Return:

+-------------+
| currentDate |
+-------------+
| 2024-07-10  |
+-------------+