The SUBSTRING64 function returns a variable-length character string of the large object column or variable parameter.
SUBSTRING64 ( large-object-column, start [, length ] )
large-object-column The name of a LONG VARCHAR or LONG BINARY column or variable.
start An 8-byte integer indicating the start of the substring. SUBSTRING64 interprets a negative or zero start offset as if the string were padded on the left with “non-characters.” The first character starts at position 1.
length An 8-byte integer indicating the length of the substring. If length is negative, an error is returned.
Given a column named col1 that contains the string (“ABCDEFG”), the SUBSTRING64 function returns the following values:
SUBSTRING64( col1, 2, 4 )
returns
the string “BCDE”
SUBSTRING64( col1, 1, 3 )
returns
the string “ABC”
SUBSTRING64( col1, 0, 3 )
returns
the string “AB”
SUBSTRING64( col1, -1, 3 )
returns
the string “A”
If any of the arguments are NULL, SUBSTRING64 returns NULL.
Nested operations of the functions SUBSTRING64, SUBSTRING, SUBSTR, BYTE_SUBSTR, and BYTE_SUBSTR64 do not support large object columns or variables.
SUBSTRING64 supports searching LONG VARCHAR and LONG BINARY columns and LONG VARCHAR and LONG BINARY variables of any size of data. Currently, a SQL variable can hold up to 2GB - 1 in length.