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.

8 comments :

  1. Iam really satisfy by your information.
    It's well-written, to the point, and relative to what I do.
    I like it very much for giving information on
    Excellent Informatica Online Training
    .

    ReplyDelete
  2. Nice information. I was searching for the same. It helped me alot and saved my time. Thanks alot. informatica online training .

    ReplyDelete
  3. Nice information. I was searching for the same. It helped me alot and saved my time. Thanks alot. PHP Online Training .

    ReplyDelete

  4. Great Information admin thanks For Your Information and Any body wants
    learn SAS through Online for Details Please go through the LinkSAS(Statistical Analysis System) Online Training 

    ReplyDelete
  5. 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
  6. The information which you have provided is very good. It is very useful who is looking for selenium Online Course Hyderabad

    ReplyDelete

> Related Posts with Thumbnails
 

Copyright © 2012. GS dot net - All Rights Reserved - Design by BTDesigner - Proudly powered by Blogger