Show TOC

Comparison predicateLocate this document in the navigation structure

The comparison predicate is used to compare two values. The left hand side operand has to be a value expression whereas the right hand sight operand can additionally be a dynamic parameter specification or a scalar sub-query.

Syntax

               <comparison predicate> ::=  
         <value expression> 
                 <comparison operator> 
                      ( <value expression> 
                      | <dynamic parameter specification> 
                      | <scalar subquery> ).

<comparison operator> ::= '<' | '=' | '>' | '<=' | '<>' | '>='.

            

The data types of the two <value expression> s in the <comparison predicate> must be comparable.

If either of the < value expression >s is NULL, the result of the <comparison predicate> is unknown.

Note

It is not possible to test for NULL values with a comparison predicate. You may wish to use a null predicate instead.

More information about comparable types: Open SQL Data Types

Examples

               SELECT * FROM a WHERE c > 0
            

Comparison predicate. This SELECT yields all rows from table a where the column a.c has a value larger than 0 .

               DELETE FROM employees WHERE employee_id = ?
            

Dynamic Parameter in Comparison Predicate. All employees with the employee_id equal to a given parameter are delete from the table employees .