×
☰ See All Chapters

Oracle INSTR Function

Oracle INSTR function returns the position of the first occurrence of a specified value in a string.

Oracle INSTR Function Syntax

INSTR(CHARACTERSET, 'VALUE')

CHARACTERSET: The string to search from. INSTR function searches a string of characters from this CHARACTERSET.

VALUE: The string to search for. INSTR function searches for this value.

Oracle INSTR Function Example

Creating table for demonstrating INSTR Function

CREATE TABLE NAME

(

  FNAME  VARCHAR(10 )    NOT NULL,

  LNAME  VARCHAR(10 )

);

Insert into NAME (FNAME, LNAME) Values ('ADI', 'TEMP');

Insert into NAME (FNAME, LNAME) Values ('NAVEEN', 'SHETTY');

Insert into NAME (FNAME, LNAME) Values ('ARJUN', 'SHETTY');

Insert into NAME (FNAME, LNAME) Values ('HARISH', 'GOWDA');

Insert into NAME (FNAME, LNAME) Values ('HARI', 'PRASAD');

Insert into NAME (FNAME, LNAME) Values ('ARJUN', 'SHETTY');

Insert into NAME (FNAME, LNAME) Values ('KIRAN', 'KUMAR');

COMMIT;

Example 1

SELECT  FNAME, LNAME, INSTR(LNAME,'TTY')  

FROM NAME

oracle-instr-function-0

Example 2

SELECT  FNAME,LNAME,INSTR(LNAME,'TY')

FROM NAME

oracle-instr-function-1


All Chapters
Author