Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

regexp_replace - too heavy?

marcoAug 25 2011 — edited Aug 25 2011
I've got code for extracting numbers from varchar2 column:
with t1 as (
select 1 as acode, '100,00' as avalue from dual union all 
select 2 as acode, '100.00' as avalue from dual union all 
select 3 as acode, '100.00%' as avalue from dual union all 
select 4 as acode, '100.00perc' as avalue from dual 
           )
select acode, nvl(abs(regexp_replace(replace(avalue,',','.'),'[^1,2,3,4,5,6,7,8,9,0,.,]')),0) as avalue 
from t1
After few weeks of using we received complain, the Customer said that "sometimes" the procedure works too long. He said, it always works about two minutes, but "sometimes" it can work more than 24 hours! He investigated the issue and decided that the problem is regexp_replace (it's too heavy).

Could you please:

1) explain to me is it true that regexp_replace is too heavy

2) give me solution how do I receive the same result without regexp_replace.

Actually, I'm not trying to prove that regexp_replace is normal. It's a pity, but I can't discuss the issue with the Customer. I'm just trying to understand details for myself.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 22 2011
Added on Aug 25 2011
6 comments
302 views