SQL>
SQL> -- Using IF...ELSIF to determine a grade.
SQL> DECLARE
2 variable_Score Number := 85;
3 variable_LetterGrade Char(1);
4 BEGIN
5 IF variable_Score >= 90 THEN
6 variable_LetterGrade := 'A';
7 ELSIF variable_Score >= 80 THEN
8 variable_LetterGrade := 'B';
9 ELSIF variable_Score >= 70 THEN
10 variable_LetterGrade := 'C';
11 ELSIF variable_Score >= 60 THEN
12 variable_LetterGrade := 'D';
13 ELSE
14 variable_LetterGrade := 'E';
15 END IF;
16 DBMS_OUTPUT.PUT_LINE('Your Letter Grade is: ' || variable_LetterGrade);
17 END;
18 /
Your Letter Grade is: B
PL/SQL procedure successfully completed.
SQL>
SQL>
|