SUBSTR returns a substring, specified by
y and
z,
of
x.
>>-SUBSTR(x,y-+----+-)-----------------------------------------><
'-,z-'
- x
- String expression. It specifies the string from which the substring
is extracted. If x is not a string, it is converted to character.
- y
- Expression that is converted to FIXED BINARY(31,0). y specifies
the starting position of the substring in x.
- z
- Expression that is converted to FIXED BINARY(31,0). z specifies
the length of the substring in x. If z is zero,
a null string is returned. If z is omitted, the substring
returned is position y in x to the end of x.
The STRINGRANGE condition is raised if z is negative or
if the values of y and z are such that the substring
does not lie entirely within the current length of x. It
is not raised when y = LENGTH(x)+1 and z = 0.
For an example of the SUBSTR built-in function, see SEARCH.