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!

How to use regexp_like to not include a string.

951544Jul 24 2012 — edited Jul 26 2012
My oracle version is 11g
table struct
A TABLE
NUM COMMENTS
1 HAPPY BIRTHDAY!CHECK .
2 HAPPY BIRTHDAY!complete CHECK.
3 HAPPY BIRTHDAY!CHECK complete.
4 TODAY IS A GOOD DAY.

B TABLE
NUM REGEX
1 [^\W*complete\W*]
2 today

use

select A.COMMENTS from A WHERE exists (select 1 from B where B.NUM = A.NUM AND regexp_like(A.COMMENTS, B.REGEX, 'i'));

case 1
get the records not include complete

case 2
get the records include today

should only use
WHERE REGEXP_LIKE ('02:HAPPY BIRTHDAY!complete CHECK.', 'complete', 'i');

can not use
WHERE NOT REGEXP_LIKE ('02:HAPPY BIRTHDAY!complete CHECK.', 'complete', 'i');

How to write the regex in table B record one?
Anyone got any suggestions?
more info that [^\W*complete\W*] can not do this.

帖子经 user13674298编辑过
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 23 2012
Added on Jul 24 2012
19 comments
6,177 views