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_like that skips on error?

David BalažicAug 22 2018 — edited Oct 2 2018

Hi!

In the case below:

create table t1 ( regex varchar2(100), flag char(1));

insert into t1 values('foo','1');

insert into t1 values('bar','1');

insert into t1 values('ba(z','0');

select * from t1 where regexp_like('foo', regex, 'i');

drop table t1;

It returns the error:

ORA-12725: unmatched parentheses in regular expression

Even when specifying an additional condition, like: select * from t1 where regexp_like('foo', regex, 'i') and flag='1';

the same error is returned (not always, it seems to depend on the chosen plan)

The question: How to skip rows that have "broken" regex?

In other words, how to make regexp_like return false instead of error for those cases?

Define and use some custom wrapper function?

PS: I'm using DB version 11.2.0.4

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 30 2018
Added on Aug 22 2018
24 comments
1,670 views