Oracle String/Char Function - Oracle/PLSQL INSTRB Function






This Oracle tutorial explains how to use the Oracle/PLSQL INSTRB function.

The Oracle/PLSQL INSTRB function returns the location of a substring in a string using bytes not characters.

Syntax

The syntax for the Oracle/PLSQL INSTRB function is:

INSTRB( string, substring [, start_position [,  nth_appearance ] ] )

string is the string to search.

string can be CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB.

substring is the substring to search for.

substring can be CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB.

start_position is optional. Defaults to 1.

The first position in the string is 1. If the start_position is negative, INSTRB counts start_position from the end of string and searches towards the beginning of string.

nth_appearance is the nth appearance of substring. This is optional. Defaults to 1.





Example

INSTRB('java2s.com', 'j')
-------------------------
                       1