INSTR#

Functionality:#

This Oracle function will search a string for substring. The function returns an integer indicating the position of the character in string that is the first character of this occurrence

Parameters: #

STRING The source, or original, string
SUBSTR The sub string that you are looking for
POSITION (optional) The position in the STRING that you want to start searching for SUBSTRING. If omitted, it defaults to 1.
OCCURRENCE (optional) The number of the occurrence that you are looking for SUBSTR of. If provided, must be a positive integer. If omitted, defaults to 1

Returns: #

Number

Errors: #

None

Operations: #

If start position is 0 or omitted , then start position is taken as 1

If start position is negative, then substr starts at the end and counts backwards

Example:#

INSTR('CORPORATE FLOOR','OR', 3, 2) will return 14: the position of the second OR in “CORPORATE FLOOR”, starting from the third character . Note that the numbering starts from the first character.

INSTR('CORPORATE FLOOR','OR', -3, 2) will return 14 – the position of the second OR in “CORPORATE FLOOR”, starting from the third character from the right and going backwards .


Notes #

Click to create a new notes page