What do you mean by Oracle IN Operator and how to use with syntax and examples
meda Changed status to publish 04/03/2022
IN operator is can be used easily test multiple values if an expression is equal to any member in a list
its Syntax:
SELECT column
FROM table
WHERE column IN (value1, value2, value3,value4…value_n);
Example:
SQL>F:\app\dell\virtual\product\12.2.0\dbhome_1\bin>sqlplus/nolog SQL*Plus: Release 12.2.0.1.0 Production on Thu Mar 3 10:15:34 2022 Copyright (c) 1982, 2016, Oracle. All rights reserved. SQL> conn BIuser@orcl Enter password: Connected. --when we select all of the list column without IN operator SQL> SELECT NAME,SALARY,AGE FROM AMAN; NAME SALARY AGE -------------------- ---------- ---------- MERI 2000 18 SAMI 5000 28 ABEBE 4000 24 KEBEDE 9000 34 DANIEL 7600 44 ALMAZ 5000 30 LIYA 7000 29 7 rows selected. -- when we can use IN operator in the above table SQL> SELECT NAME,SALARY,AGE FROM AMAN WHERE ID IN('1','3','5') ORDER BY AGE 2 ; NAME SALARY AGE -------------------- ---------- ---------- MERI 2000 18 ABEBE 4000 24 DANIEL 7600 44 SQL>
meda Changed status to publish 05/03/2022