Previous Topic: Introduction to FunctionsNext Topic: The TRIM Function


Character-oriented Functions

The optional SUBSTR keyword, specified as part of the search criteria on an SQL statement, allows that statement to examine or return parts of character strings. Use the following syntax for the SUBSTR keyword:

SUBSTR (colname FROM xx FOR yy)

The SUBSTR clause fetches from the named column yy characters starting with the character in position xx. For example, the following SUBSTR clause selects characters 5 through 8 from the RECOV_PROC column of the SYSTEMS table:

SUBSTR (RECOV_PROC FROM 5 FOR 3)