

That is, for a simple CASE expression, the database evaluates each comparison_expr value only before comparing it to expr, rather than evaluating all comparison_expr values before comparing any of them with expr. Oracle Database uses short-circuit evaluation. If no condition is found to be true, and an ELSE clause exists, Oracle returns else_expr. In a searched CASE expression, Oracle searches from left to right until it finds an occurrence of condition that is true, and then returns return_expr. You cannot specify the literal NULL for every return_expr and the else_expr. THEN pairs meet this condition, and an ELSE clause exists, then Oracle returns else_expr. THEN pair for which expr is equal to comparison_expr and returns return_expr. In a simple CASE expression, Oracle Database searches for the first WHEN.

The syntax is:ĭescription of the illustration case_expression.gifĭescription of the illustration simple_case_expression.gifĭescription of the illustration searched_case_expression.gifĭescription of the illustration else_clause.gif ELSE logic in SQL statements without having to invoke procedures.
