PL/SQL Case Statement

PL/SQL Case Statement - This instruction can be used in SQL queries.

PL/SQL Simple CASE Statement, CASE - WHEN

Example:

DECLARE
   v_val VARCHAR2(2);
BEGIN
   v_val := 'D';
   CASE v_val
     WHEN 'A' THEN DBMS_OUTPUT.PUT_LINE('1');
     WHEN 'B' THEN DBMS_OUTPUT.PUT_LINE('2');
     WHEN 'C' THEN DBMS_OUTPUT.PUT_LINE('3');
     WHEN 'D' THEN DBMS_OUTPUT.PUT_LINE('4');
     WHEN 'F' THEN DBMS_OUTPUT.PUT_LINE('5');
     ELSE DBMS_OUTPUT.PUT_LINE('No such value');
   END CASE;
END;