InStr () returns the position of the string to be intercepted in the source string
Grammar:
InStr (Sourcestring,deststring,startposition,appearposition)
Parameter description:
Sourcestring: The source string to find in this string.
Deststring: The string to find in the sourcestring.
StartPosition: represents where to start the lookup in the sourcestring string. This parameter is optional if the default of 1 is ignored. If this parameter is a positive number, it is retrieved from left to right. If negative, retrieves from right to left. Returns the index position of the lookup string in the source string.
Appearposition: Represents the first occurrence of the deststring, this parameter can be ignored, the default is 1, set negative number will be an error.
If deststring is not found in Sourcestring, 0 is returned.
Both sourcestring and deststring can is any of the datatypes CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB. The value returned is of number datatype.
--Returns the position of the string to be intercepted in the source string
Select InStr (' abc ', ' A ') from dual; --Return 1
Select InStr (' abc ', ' BC ') from dual; --Return 2
Select InStr (' AB c abc ', ' A ', 1,2) from dual; --Return 6
Select InStr (' Uoabc ', ' BC ', -1,1) from dual; --Return 4
Select InStr (' abc ', ' d ') from dual; --Return 0
Extensions: INSTRB (), INSTRC (), INSTR2 (), INSTR4 ()