!--a11y-->
SUBSTR(x,a,b) is a string function that outputs part of the character string x (string specification of length n). Only expressions that have an alphanumeric value as a result are allowed as string specification x. LONG values are allowed. If x is a LONG value, you must specify length b of the desired subarea.
a and b are expressions. The value b may not be larger than the column definition for a CHAR column.
  | 
Result of the SUBSTR(x,a,b) Function  | 
SUBSTR(x,a,b)  | 
Part of the character string x that starts at the ath character and is b characters long.  | 
SUBSTR(x,a)  | 
SUBSTR(x,a,n-a+1) supplies all of the characters in the character string x from the ath character to the last (nth) character.  | 
b is an unsigned integer  | 
SUBSTR(x,a,b) b can also have a value that is greater than (n-a+1).  | 
b is not an unsigned integer  | 
SUBSTR(x,a,b) b must not be greater than (n-a+1).  | 
b>(n-a+1)  | 
SUBSTR(x,a) As many blanks (code attribute ASCII, UNICODE) or binary zeros (code attribute BYTE) are appended to the end of this result as are needed to give the result the length b.  | 
x, a, or b is a NULL value  | 
NULL value  | 
SQL Tutorial, 
Functions, 
Changing
character strings
