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: PL/SQL substr(instr oracle

Re: PL/SQL substr(instr oracle

From: Brian Peasland <oracle_dba_at_remove_spam.peasland.com>
Date: Wed, 18 Jun 2003 20:14:56 GMT
Message-ID: <3EF0C840.3A42C806@remove_spam.peasland.com>


I guess it goes back to the lack of original information. As you stated, this solution assumes that there will always be four underscores. What if it has to handle strings with three or four? Then one needs to parse the string.

Cheers,
Brian

Rahul wrote:
>
> YC_CHOICE_IS_MY_CHOICE ===> YC_CIMC
>
> Assuming you have four underscores in your txt
>
> select substr(txt,1,instr(txt,'_')-1) || substr(txt,instr(txt,'_')+1 ,1)||
>
> substr(txt,instr(txt,'_',2)+1,1) ||substr(txt,instr(txt,'_',3)+1,1)
> || substr(txt,instr(txt,'_',4)+1,1)
>
> from t1

-- 
===================================================================

Brian Peasland
oracle_dba_at_remove_spam.peasland.com

Remove the "remove_spam." from the email address to email me.


"I can give it to you cheap, quick, and good. Now pick two out of
 the three"
Received on Wed Jun 18 2003 - 15:14:56 CDT

Original text of this message

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