|Oracle8i SQL Reference
Release 2 (8.1.6)
Expressions, Conditions, and Queries, 3 of 4
A condition specifies a combination of one or more expressions and logical operators that evaluates to either
FALSE, or unknown. You must use this syntax whenever condition appears in SQL statements in Chapter 7, "SQL Statements".
You can use a condition in the
WHERE clause of these statements:
You can use a condition in any of these clauses of the
A condition could be said to be of the "logical" datatype, although Oracle does not formally support such a datatype.
The following simple condition always evaluates to
The following more complex condition adds the
SAL value to the
COMM value (substituting the value 0 for null) and determines whether the sum is greater than the number constant 2500:
Logical operators can combine multiple conditions into a single condition. For example, you can use the
AND operator to combine two conditions:
Here are some valid conditions:
name = 'SMITH' emp.deptno = dept.deptno hiredate > '01-JAN-88' job IN ('PRESIDENT', 'CLERK', 'ANALYST') sal BETWEEN 500 AND 1000 comm IS NULL AND sal = 2000
Conditions can have several forms, as shown in the following syntax. The description of each statement in Chapter 7, "SQL Statements", documents the restrictions on the conditions in the statement. The sections that follow describe the various forms of conditions.
A simple comparison condition specifies a comparison with expressions or subquery results.
For information on comparison operators, see "Comparison Operators".
A group comparison condition specifies a comparison with any or all members in a list or subquery.
A membership condition tests for membership in a list or subquery.
A range condition tests for inclusion in a range.
NULL condition tests for nulls.
EXISTS condition tests for existence of rows in a subquery.
LIKE condition specifies a test involving pattern matching.
A compound condition specifies a combination of other conditions.