Oracle8i SQL Reference Release 2 (8.1.6) A76989-01 |
|
Operators, 7 of 10
A logical operator combines the results of two component conditions to produce a single result based on them or to invert the result of a single condition. Table 3-5 lists logical operators.
For example, in the WHERE
clause of the following SELECT
statement, the AND
logical operator is used to ensure that only those hired before 1984 and earning more than $1000 a month are returned:
SELECT * FROM emp WHERE hiredate < TO_DATE('01-JAN-1984', 'DD-MON-YYYY') AND sal > 1000;
Table 3-6 shows the result of applying the NOT
operator to a condition.
|
TRUE |
FALSE |
UNKNOWN |
---|---|---|---|
NOT |
|
|
|
Table 3-7 shows the results of combining two expressions with AND
.
AND |
TRUE |
FALSE |
UNKNOWN |
TRUE |
|
|
|
FALSE |
|
|
|
UNKNOWN |
|
|
|
Table 3-8 shows the results of combining two expressions with OR
.
OR |
TRUE |
FALSE |
UNKNOWN |
TRUE |
|
|
|
FALSE |
|
|
|
UNKNOWN |
|
|
|
|
Copyright © 1999 Oracle Corporation. All Rights Reserved. |
|