How To Use IN Conditions

Q

How To Use IN Conditions? - Oracle DBA FAQ - Understanding SQL Basics

✍: FYIcenter.com

A

An IN condition is single value again a list of values. It returns TRUE, if the specified value is in the list. Otherwise, it returns FALSE.

Some examples are given in the script below:

SELECT CASE WHEN 3 IN (1,2,3,5) THEN 
  'TRUE' ELSE 'FALSE' END FROM DUAL;
TRUE 

SELECT CASE WHEN 3 NOT IN (1,2,3,5) THEN 
  'TRUE' ELSE 'FALSE' END FROM DUAL;
FALSE   

SELECT CASE WHEN 'Y' IN ('F','Y','I') THEN 
  'TRUE' ELSE 'FALSE' END FROM DUAL;
TRUE

2007-04-23, 4710👍, 0💬