/*
 * case_statement.sql
 * Appendix I, Oracle Database XE PHP Web Programming
 * by Michael McLaughlin
 *
 * Demonstrate the behavior of a SQL case statement.
 */

-- Unremark for debugging script.
SET PAGESIZE 999
SET SERVEROUTPUT ON SIZE 1000000

BEGIN

  CASE TRUE
  WHEN (1 > 3) THEN
    dbms_output.put_line('One is greater than three.');
  WHEN (3 < 5) THEN
    dbms_output.put_line('Three is less than five.');
  WHEN (1 = 2) THEN
    dbms_output.put_line('One equals two.');
  ELSE
    dbms_output.put_line('Nothing worked.');
  END CASE;

END;
/
