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!

Way to check data in a table based on a comma separated string

$a!Aug 6 2018 — edited Aug 8 2018

Hi All,

I have a variable  which holds a comma separated values as a string. Now I want to delete certain rows from a table based on the column whose values are the comma separated values.

Here is the case:

create table sail_1 (c1 varchar2(10));

insert into sail_1 values('yes');

insert into sail_1 values('no');

insert into sail_1 values('may be');

commit;

declare

v1 varchar2(100):='yes,no,may be';

begin

delete from sail_1 where c1 in v1;

end;

/

Now, no rows are being deleted from the table (which might seem an obvious thing for the experts ).

So what change do i need to do.

I don't want to separate the values, store them in a collection and then use them. I want the variable v1 to be massaged some way and need the desired output.

Regards,

Sail

This post has been answered by BluShadow on Aug 6 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 5 2018
Added on Aug 6 2018
15 comments
3,172 views