DEV Community

AntDB
AntDB

Posted on

AntDB-Oracle Compatibility Developer's Manual P3–76

IN

The operator IN on the right side is a subquery in parentheses, and this subquery must return the contents of only one column. We compute the expression on the left side of the operator and compare it with each row in the subquery result. If a record is found that matches the one in the subquery, then the result of the IN operation is "true". If there are no equal rows (including specific cases like subqueries that return no rows) then the result is "false".

expression IN (subquery)

Note that if the expression on the left side of the operator produces a null value, or if there are no equal rows in the table on the right side of the operator, and at least one of the rows returned by the subquery on the right side produces a null value, then the result of the IN construct will be null, not "false". This is consistent with the general SQL rule for combining null values with Boolean variables.

As with EXISTS, it is not wise to assume that the subquery will complete the query for all rows involved.

Top comments (0)