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!

Problems using REGEXP_REPLACE

BillWMar 22 2011 — edited Mar 22 2011
Greetings,

I have the following code segment (for simplicity I have removed the writes to file which are used for testing results) -

set serveroutput on
DECLARE
V2 CLOB;
cursor c_clob is
select c10
from bill_t392;
BEGIN
open c_clob;
loop
exit when c_clob%NOTFOUND;
fetch c_clob into V2;
V2 := REGEXP_REPLACE(V2,'110300','XXXXXXXXXXXX');
end loop;
commit;
close c_clob;
end;
/

The table bill_t392 is a small table, only 96 records. I write out the value of V2 immediately after the REGEXP_REPLACE command executes and see that in fact V2 has been updated properly. But after the procedure completes the SQL statement -

select c10 from bill_t392
where regexp_like (c10,'XXXXXXXX')
/

returns no rows but the statement

select c10 from bill_t392
where regexp_like (c10,'110300')
/

does return the original row unchanged. I am puzzled as it appears that the change is only in effect during the execution of the procedure and that the commit doesn't take place. I'm sure I am missing something but can't find it. Any suggestions greatly appreciated.

Thanks
Bill Wagman
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 19 2011
Added on Mar 22 2011
4 comments
593 views