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!

string search that includes whitespace but not comma

vikram (959352)Jul 3 2015 — edited Jul 3 2015

Hi All,

I am looking for all records that has one or more whitespace but it should not contain comma.

Example: in the "Test_Tab" it should fetch only 1 record: 'onlyspace '.

Database version: 11.2.0.4.0

Script:

create table test_tab (col1 varchar2(100));

insert into test_Tab values ('onlycommma,');

insert into test_tab values ('onlyspace ');

insert into test_tab values ('both ,');

I did this using INSTR like

select * from test_tab

where instr(col1,',') = 0 and instr(col1,' ') > 0;

But I am trying to accomplish this using regular expression. I tried to do the same but unable to write multiple conditions within REGEXP_LIKE.

Please help.

Thanks in advance.

Regards

Vikram

This post has been answered by Frank Kulash on Jul 3 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 31 2015
Added on Jul 3 2015
4 comments
1,602 views