Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE or REPLACE PROCEDURE RankGPA
- IS
- vSnum student.snum%type;
- vSname student.sname%type;
- vGPA student.GPA%type;
- vMajor student.major%type;
- CURSOR rankGPA_cursor IS
- SELECT s1.snum, s1.sname, s1.gpa, count( s2.gpa ) + 1 as rank, s1.major
- FROM students s1
- LEFT JOIN students s1
- ON s1.GPA < s2.GPA
- GROUP BY s1.snum, s1.sname, s1.gpa, s1.Major
- ORDER BY 4;
- BEGIN
- OPEN rankGPA_cursor;
- FETCH rankGPA_cursor INTO vSnum, vSname, vGPA, vMajor;
- END;
Add Comment
Please, Sign In to add comment