SUBTO
SUBTO returns a substring, specified by y and z, of x.
- 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 ending position of the substring in x. If z = y-1, a null string is returned. If z is omitted, the substring returned is position y in x to the end of x.
SUBTO(x,y) is equivalent to SUBSTR(x,y), and SUBTO(x,y,z) is equivalent to SUBSTR(x,y,z-y+1).
The STRINGRANGE condition is raised for a SUBTO reference if and only if the STRINGRANGE
condition would be raised for the equivalent SUBSTR reference. In particular, this means that if k =
length(x), then STRINGRANGE would be raised for
SUBTO(x,y,z) under any of these 5
conditions:
y < 1
y > k+1
y = k+1 then unless z = k
z-y+1 < 0
z > k