Re: substr instr

From: Vladimir Andreev <vandreev_at_gmail.com>
Date: Fri, 31 Jul 2009 10:08:41 +0200
Message-ID: <442adaf60907310108t3c1fd1e1h8dd094a167cf6c6_at_mail.gmail.com>



>
> But not in v9 that the OP's using...
>
> Rich

Drat! Missed that one small detail :-(

Oh well... let's try to lose the InStr()s and SubStr()s altogether:

with demo as (select 'Start net counter : 203542, 201282' x from dual) select rtrim(rtrim(ltrim(x,'Start net counter :'),'0123456789 '),',') result from demo;

albeit with caveats:
a) the constant prefix should contain no other characters than those in LTrim's first parameter and definitely no digits b) the data may contain at most one number and no commas after the first comma
c) I'm not at all sure a couple of InStr()s and a SubStr() would be slower than three Trim()s (or alternatively a Replace() and two Trim()s, as Jaromir pointed out), but I have no V9i to test.

Cheers!
Flado

--
http://www.freelists.org/webpage/oracle-l
Received on Fri Jul 31 2009 - 03:08:41 CDT

Original text of this message