EQL supports the following string functions.
Function
|
Description
|
CONCAT
|
Concatenates two string arguments into a
single string.
|
SUBSTR
|
Returns a part (substring) of a character
expression.
|
TO_STRING
|
Converts a value to a string.
|
CONCAT function
CONCAT is a row function that takes two string
arguments and concatenates them into a single string. Its syntax is:
CONCAT(string1, string2)
Each argument can be a literal string (within single quotation
marks), an attribute of type string, or any expression that produces a string.
This sample query uses literal strings for the arguments:
RETURN results AS SELECT
CONCAT('Jane ', 'Wilson') AS FullName
GROUP
This similar query uses two string-type standard attributes:
RETURN results AS SELECT
ARB(CONCAT(S_NAME,S_ADDRESS)) AS Supplier
GROUP
SUBSTR function
The
SUBSTR function has two syntaxes:
SUBSTR(string, position)
SUBSTR(string, position, length)
where:
- string is the
string to be parsed.
- position is a
number that indicates where the substring starts (counting from the left side).
Note that the parameter is not zero indexed, which means that in order to start
with the fifth character, the parameter has to be 5. If 0 (zero) is specified,
it is treated as 1.
- length is a number
that specifies the length of the substring that is to be extracted.
TO_STRING function
The
TO_STRING function takes an integer value and returns
a string equivalent. Its syntax is:
TO_STRING(int)
If the input value is NULL, the output value will also be NULL.
This sample query converts the value of the P_SIZE integer attribute
to a string equivalent:
RETURN results AS SELECT
ARB(TO_STRING(P_SIZE)) AS Sizes
GROUP