Can I get after -OO all characters?
Derek Xu, October 15, 2018 - 2:20 am UTC
Hi Tom,
Thank you very much for your support, another question can I get after -OO all characters?
And how can I get all characters after first '-' and before -OO all characters?
Kind Regards,
Derek
But why?
AndyP, October 15, 2018 - 7:13 am UTC
I feel like I've turned into the "unnecessary use of regexp" police, but why not just do this?
with data as
(
select '000-O 1000 DENIS GRATTON TRANSPORT LTD-OO Profile Class-PHONE-25183' x
from dual
)
select x
,instr(x,'-OO')
,substr(x,1,instr(x,'-OO')-1) before
,substr(x,instr(x,'-OO')+3,length(x)) after
from data;
X INSTR(X,'-OO')
------------------------------------------------------------------- --------------
BEFORE
-------------------------------------------------------------------
AFTER
-------------------------------------------------------------------
000-O 1000 DENIS GRATTON TRANSPORT LTD-OO Profile Class-PHONE-25183 39
000-O 1000 DENIS GRATTON TRANSPORT LTD
Profile Class-PHONE-25183
October 16, 2018 - 2:04 am UTC
As we say in Australia, there is more than one way to skin a cat.