Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL substr(instr oracle
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