Oracle Select In Statement
The Oracle SELECT IN
operator is used to reduce the use of multiple OR conditions in a SELECT, INSERT, UPDATE, or DELETE statement.
Oracle SELECT In Operator Syntax
To reduce the use of multiple OR conditions in a SELECT, INSERT, UPDATE, or DELETE statement, use the following syntax:
Syntax
SELECT col1, col2,....
FROM tablename
WHERE expression IN (value1, value2, ...);
OR
SELECT col1, col2,....
FROM tablename
WHERE expression IN (SELECT STATEMENT);
Parameters:
tablename: The table name from which you want to fetch data.
conditions: The conditions optional parameter.
Oracle SELECT In Statement examples
The following Oracle Select In operator is used to reduce the use of multiple OR conditions in a SELECT, INSERT, UPDATE, or DELETE statement:
Example
SELECT *
FROM tblCustomerLoan
WHERE firstName IN ('Dev', 'Ramesh', 'Mahesh');
Note:
In the above example, we are reducing the use of multiple OR conditions.
Oracle SELECT NOT IN Statement examples
The following Oracle statement to shows NOT operator with SELECT IN operator:
Example
SELECT *
FROM tblCustomerLoan
WHERE firstName NOT IN ('Dev', 'Ramesh', 'Mahesh');
Note:
In the above example, will return all rows where the "firstName is not 'Dev', 'Ramesh', 'Mahesh'.