Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Behaviour of INSTR

Re: Behaviour of INSTR

From: hpuxrac <johnbhurley_at_sbcglobal.net>
Date: 8 May 2007 18:02:39 -0700
Message-ID: <1178672559.290874.22670@n59g2000hsh.googlegroups.com>


On May 8, 6:29 pm, tvamsid..._at_gmail.com wrote:
> Hello,
>
> I noticed results I wasn't expecting from the InStr function. Thought
> I'd ask if my expectations are reasonable.
>
> SQL> select instr('A---B---C------E', '---', 1, 3) as pos from dual;
>
> POS
> ----------
> 10
>
> SQL> select instr('A---B---C------E', '---', 1, 4) as pos from dual;
>
> POS
> ----------
> 11
>
> I was expecting the second statement (the last parameter==4) to return
> 13 instead of 11.
>
> My reason: the function should skip over (4-1) *full* insances of
> '---' and find the first one *after* that, not after the first
> character of the instance number (4-1)
>
> Its simple enough to write a function of my own to do this, but, is
> there a built-in function that can do this?
>
> Thanks.
> Vamsi.

It works the way it is documented ( http://tahiti.oracle.com ) ... if you find and produce a reproducible test case that doesn't do what it should you can file a bug.

Have you looked at the documentation for it?

What exactly are you trying to accomplish in your application? Newer versions of oracle support regular expressions. Received on Tue May 08 2007 - 20:02:39 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US