|
|
The SUBSTRING Function
Syntax for the SUBSTRING function:
source-string is a character or binary string expression.
start-position and string-length are integer value expressions.
Rules:
- SUBSTRING returns a character or binary string containing string-length characters of source-string, starting at the character specified by start-position, and in the same sequence as they appear in source-string.
If any of these positions are before the start or after the end of source-string, then no character is returned for that position. If all positions are outside the source string, an empty string is returned.
- The first character in source-string has position 1.
- If the data type of source-string is variable-length character, then the result of the SUBSTRING function is a variable-length character with maximum string length equal to the maximum length of source-string.
- If the data type of source-string is fixed-length character, then the result of the SUBSTRING function is a variable-length character with maximum string length equal to the fixed length of source-string.
- If the data type of source-string is variable-length binary, then the result of the SUBSTRING function is a variable-length binary with maximum string length equal to the maximum length of source-string.
- If the data type of source-string is fixed-length binary, then the result of the SUBSTRING function is a variable-length binary with maximum string length equal to the fixed length of source-string.
- If string-length is negative, or if start-position is greater than the number of characters in source-string, the function fails and an error is returned.
- If string-length is omitted then it is assumed to be:
CHAR_LENGTH(source-string) + 1 - start-position
i.e. the remainder of source-string, starting at start-position, is returned.
- If the value of any operand is NULL, then the result of the function is NULL.
|
Upright Database Technology AB Voice: +46 18 780 92 00 Fax: +46 18 780 92 40 dbtechnology@upright.se |
|
|