Substrings return portions of character value expressions. A
substring must have the data type CHAR, VARCHAR, LONG VARCHAR,
NCHAR, or NCHAR VARYING.
To specify a substring, you must specify the value expression
and the FROM keyword, followed by the start position of the value
expression. (The first character in the string occupies position
1.) You can optionally add a FOR clause after the FROM clause
to specify the length of the value expression after the start
position.
The start position and string length values can be a numeric
value expression. By default, SQL expects the start position and
the string length to be specified in octets. You can use the SET
DIALECT or the SET CHARACTER LENGTH statements or the DIALECT
or CHARACTER LENGTH clause of the SQL module language header and
DECLARE MODULE statement to specify whether the length value is
octets or characters.
If you specify a length longer than the string, SQL returns
only valid characters in the string and terminates the returned
substring after the last valid character.
If either operand of the substring is a null value, the resulting
value is also null.
When you use a substring with the equal (=) conditional
operator, the operation is case sensitive.