Instr?
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Instr?

  1. #1
    Join Date
    Nov 2000
    Posts
    440

    Instr?

    I want to find the position of the last occurence of a string.

    ex:

    '1,2,3,4,5,6,1,2,3'

    The position of the last occurence of the character '1' is 13.

    if i do
    SQL> select instr('1,2,3,4,5,6,1,2,3','1') from dual;

    INSTR('1,2,3,4,5,6,1,2,3','1')
    ------------------------------
    1

    it gives me only the first occurence of the string

    I need a function that does this, anyone?

  2. #2
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    Code:
    SQL> select * from xyz;
    
             X Y                    Z
    ---------- -------------------- ----
             1 1,5,2,3,5,7,1,2,4,5  777
    
    SQL> select y, instr(y,'2',-1) from xyz;
    
    Y                    INSTR(Y,'2',-1)
    -------------------- ---------------
    1,5,2,3,5,7,1,2,4,5               15
    Jeff Hunter
    marist89@yahoo.com
    http://marist89.blogspot.com/
    Get Firefox!
    "I pledge to stop eating sharks fin soup and will not do so under any circumstances."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width