Oracle9i SQL Reference
Release 1 (9.0.1)

Part Number A90125-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to beginning of chapter Go to next page

Conditions, 3 of 11


Comparison Conditions

Comparison conditions compare one expression with another. The result of such a comparison can be TRUE, FALSE, or UNKNOWN.


Note:

Large objects (LOBs) are not supported in comparisons conditions. However, you can use PL/SQL programs for comparisons on CLOB data. 


Table 5-2 lists comparison conditions.

Table 5-2  Comparison Conditions
Condition  Purpose  Example 
=
 

Equality test. 

SELECT *
  FROM employees
  WHERE salary = 2500;
 
!=
^=
<   >
¬=
 

Inequality test. Some forms of the inequality condition may be unavailable on some platforms. 

SELECT *
  FROM employees
  WHERE salary != 2500;
 
>

<
 

"Greater than" and "less than" tests. 

SELECT * FROM employees
  WHERE salary > 2500;
SELECT * FROM employees
  WHERE salary < 2500;
 
>=

<= 
 

"Greater than or equal to" and "less than or equal to" tests. 

SELECT * FROM employees
  WHERE salary >= 2500;
SELECT * FROM employees
  WHERE salary <= 2500;
 
ANY
SOME 
 

Compares a value to each value in a list or returned by a query. Must be preceded by =, !=, >, <, <=, >=.

Evaluates to FALSE if the query returns no rows. 

SELECT * FROM employees
  WHERE salary = ANY
  (SELECT salary 
   FROM employees
  WHERE department_id = 30);
 
ALL 
 

Compares a value to every value in a list or returned by a query. Must be preceded by =, !=, >, <, <=, >=.

Evaluates to TRUE if the query returns no rows. 

SELECT * FROM employees
  WHERE salary >=
  ALL ( 1400, 3000);
 

Simple Comparison Conditions

A simple comparison condition specifies a comparison with expressions or subquery results.

simple_comparison_condition::=


Text description of conditionsa.gif follows
Text description of simple_comparison_condition

Group Comparison Conditions

A group comparison condition specifies a comparison with any or all members in a list or subquery.

group_comparison_condition::=


Text description of conditions2a.gif follows
Text description of group_comparison_condition

See Also:

SELECT 


Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback