Chapter 4: SQL Language Elements
4.9.2.80 SUFFIX function (extension)
Syntax
SUFFIX(char_expression, start_position, char_expression)
Description
The scalar function SUFFIX returns the substring of a character string starting after the position specified by start_position and the second char_expression, to the end of the string.
Arguments
char_expressionAn expression that evaluates to a character string, typically a character-string literal or column name. If the expression evaluates to null, SUFFIX returns null.
start_positionAn expression that evaluates to an integer value. SUFFIX searches the string specified in the first argument starting at that position. A value of 1 indicates the first character of the string.
char_expressionAn expression that evaluates to a single character. SUFFIX returns the substring that begins with that character. If SUFFIX does not find the character after start_position, it returns null. If the expression evaluates to more than one character, SUFFIX ignores all but the first character.
Example
SELECT C1, C2, SUFFIX(C1, 6, '.') FROM T1; C1 C2 SUFFIX(C1,6,. -- -- ------------- test.pref . pref.test s 2 records selected SELECT C1, C2, SUFFIX(C1, 1, C2) FROM T1; C1 C2 SUFFIX(C1,1,C -- -- ------------- test.pref . pref pref.test s t 2 records selected SELECT C1, C2, SUFFIX(C1, 6, '.') FROM T1; C1 C2 SUFFIX(C1,6,. -- -- ------------- test.pref . pref.test s 2 records selected