
Using the CASE-WHEN Statement
DECLARE
grade CHAR(1);
BEGIN
grade := 'B';
CASE grade
WHEN 'A' THEN dbms_output.Put_line('Excellent');
WHEN 'B' THEN dbms_output.Put_line('Very Good');
WHEN 'C' THEN dbms_output.Put_line('Good');
WHEN 'D' THEN dbms_output.Put_line('Fair');
WHEN 'F' THEN dbms_output.Put_line('Poor');
ELSE dbms_output.Put_line('No such grade');
END CASE;
END;
/

0 comments:
Post a Comment