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!

Validate if all values ​​of "in" clause exist

User_X6CCTAug 30 2022
I have a sql that I'm comparing values ​​inside an "in" clause and I should only return if they all exist. Example:

select *
from test
where field1 in ('AAA', 'BBB', ''CCC', 'DDD');

In the table "test" field "field1" I do not have the value ''CCC'. So I shouldn't bring any results.

select *
from test
where field1 in ('AAA', 'BBB', 'DDD');

In the table "test" field "field1" I have 'AAA', 'BBB', 'DDD'. So I must bring the 3 results.
Comments
Post Details
Added on Aug 30 2022
15 comments
4,711 views