Saturday, May 12, 2012

INSTR function in Sql

The INSTR function returns the location of a substring in a string. The syntax for the INSTR function is:
INSTR ( string1, string2 [, start_position [, nth_appearance ] ] )
Where
  • string1 is the string to search.
  • string2 is the substring to search for in string1.
  • start_position is the position in string1 where the search will start. This argument is optional. If omitted, it defaults to 1. The first position in the string is 1. If the start_position is negative, the function counts back start_position number of characters from the end of string1 and then searches towards the beginning of string1.
  • nth appearance is the nth appearance of string2. This is optional. If omitted, it defaults to 1.
Note: If string2 is not found in string1, then the INSTR Oracle function will return 0.


Example:
  • INSTR ('This is Informatica blog', 'i') return 3; the first occurrence of 'i'
  • INSTR ('This is Informatica blog', 'i', 1, 1) return 3; the first occurrence of 'i'
  • INSTR ('This is Informatica blog', 'i', 1, 2) return 6; the second occurrence of 'i'
  • INSTR ('This is Informatica blog', 'i', 1, 3) return 9; the third occurrence of 'i'
  • INSTR ('Tech on the net', 'e', -3, 2) return 2.

15 comments:

  1. This is very informative and this is very usefull to us.

    Informatica online training , informatica training in bangalore

    informatica online training , informatica training in bangalore , informatica training , informatica online trainig in bangalore

    ReplyDelete
  2. This really has covered a great insight on Informatica. I found myself lucky to visit your page and came across this insightful read on Informatica. Please allow me to share similar work on Informatica. Watch and gain knowledge today.
    https://www.youtube.com/watch?v=56vMQ1lG-vc

    ReplyDelete
  3. I guess Informatica and its other components and tools ease out maximise problems and helps to ease out things as well.

    Informatica Read Rest Api

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...