SUBSTR_UDF (STRING, FLOAT, FLOAT)
This is the user-defined function (UDF) overloaded with three parameters.
Definition
Extracts a substring from a named string based on position.
PUBLIC.SUBSTR_UDF(BASE_EXPRESSION STRING, START_POSITION FLOAT, LENGTH FLOAT)
Parameters
BASE_EXPRESSION
STRING
The expression from which the substring is to be extracted.
START_POSITION
FLOAT
The starting position of the substring to extract from.
LENGTH
FLOAT
The starting position of the substring to extract from.
Returns
The required substring.
Usage example
Input:
SELECT
PUBLIC.SUBSTR_UDF('ABC', -1, 1),
PUBLIC.SUBSTR_UDF('ABC', -1, 2),
PUBLIC.SUBSTR_UDF('ABC', -1, 3),
PUBLIC.SUBSTR_UDF('ABC', 0, 1),
PUBLIC.SUBSTR_UDF('ABC', 0, 2);
Output:
'','','A','','A'
Last updated