Returns the starting position of the first occurrence of one string (search-string) within another string (source-string). The first argument is the search-string. Can be binary-string, character-string, or a graphic-string expression. The second argument is the source-string. Can be binary-string, character-string, or graphic-string expression. If either argument is a binary string, both must be binary strings. POSSTR operates on a byte-count basis. Therefore, if one of the arguments includes mixed data, the shift-in and shift-out characters in the source-string must be in exactly the same place in the search-string or the string will not be found. However, POSITION does not require this exact positioning. POSITION operates on a character basis and should be used in cases of mixed data.
Example:
Select RECEIVED and SUBJECT columns as well as the starting position of the words 'GOOD' within the NOTE_TEXT column for all entries in the IN_TRAY table that contain these words.
SELECT RECEIVED, SUBJECT, POSSTR(NOTE_TEXT, 'GOOD') FROM IN_TRAY WHERE POSSTR(NOTE_TEXT, 'GOOD') <> 0