Show TOC

Syntax documentationComparison predicate Locate 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

Syntax Syntax

  1. <comparison predicate> ::=  
             <value expression> 
                     <comparison operator> 
                          ( <value expression> 
                          | <dynamic parameter specification> 
                          | <scalar subquery> ).
    
    <comparison operator> ::= '<' | '=' | '>' | '<=' | '<>' | '>='.
    
End of the code.

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 Note

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

End of the note.

More information about comparable types: Open SQL Data Types

Examples

Syntax Syntax

  1. SELECT * FROM a WHERE c > 0
End of the code.

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

Syntax Syntax

  1. DELETE FROM employees WHERE employee_id = ?
End of the code.

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