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

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL function for last index

Re: SQL function for last index

From: Marcel Stör <marcel_at_frightanic.com>
Date: Tue, 5 Oct 2004 12:34:31 +0200
Message-ID: <1096972358.746993@fuchs.cyberlink.ch>

"agis" <stag_at_hq.acn.gr> schrieb im Newsbeitrag news:cjts12$ma5$1_at_ulysses.noc.ntua.gr...
>
> "Marcel Stör" <marcel_at_frightanic.com> wrote in message
> news:1096967036.464748_at_fuchs.cyberlink.ch...
> > Hi,
> >
> > How do I find the last index (last occurrence) of a substring in a
string
> > using Oracle SQL? Sort of the opposite of the INSTR function that finds
> > the
> > *first* occurrence...
> >
> > Regards,
> > Marcel
> >
>
> You can test with this
>
> select instr('asgisj','s',-1) from dual;
> retruns 5

Thanks! It just realized that it's even in the docs: "If position is negative, Oracle counts and searches backward from the end of string."

Regards,
Marcel Received on Tue Oct 05 2004 - 05:34:31 CDT

Original text of this message

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