Q:

Write a PL/SQL program to display the description against a grade using CASE statement

0

Write a PL/SQL program to display the description against a grade using CASE statement.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

PL/SQL Code:

DECLARE
    grd CHAR(1);
  BEGIN
    -- Accept value for grade
    grd := '&new_grd';
  CASE grd
    WHEN 'A' THEN dbms_output.Put_line('Your Grade is: Outstanding');
    WHEN 'B' THEN dbms_output.Put_line('Your Grade is: Excellent');
    WHEN 'C' THEN dbms_output.Put_line('Your Grade is: Very Good');
    WHEN 'D' THEN dbms_output. Put_line('Your Grade is: Average');
    WHEN 'F' THEN dbms_output.Put_line('Your Grade is: Poor');
    ELSE dbms_output.Put_line('No such grade in the list.');
  END CASE;	
  END;
/

Sample Output:

Enter value for new_grd: D
old   5:     grd := '&new_grd';
new   5:     grd := 'D';
Your Grade is: Average

PL/SQL procedure successfully completed.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now