ROLL_NO | NAME | SECTION | CLASS | ORACLE | DEV_2000 |
---|---|---|---|---|---|
2 | Rajiv Chawla | 9025 | Student | 75 | 85 |
3 | Pramila Bordes | 9025 | Working | 45 | 45 |
4 | Nitish Bharadwaj | 9025 | Working | 67 | 75 |
5 | Anita Sood | 9025 | Student | 86 | 72 |
6 | Kalyani Deshmukh | 9025 | Working | 55 | 65 |
7 | Rakesh Surana | 9025 | Working | 95 | 95 |
8 | Alok Kumar Nath | 9025 | Working | 25 | 40 |
9 | Sushmita Bannerjee | 9025 | Student | 73 | 83 |
CREATE TABLE Dev_2000_result ( ROll_NO Number (4), TOTAL Number (3), PERCENT Number (5,2), GRADE Varchar2 (10) )
DECLARE v_student school%rowtype;
v_result oracle_result%rowtype;
grade varchar2(10);
CURSOR c1 IS
SELECT *
FROM SCHOOL;
BEGIN
FOR v_student IN c1 LOOP IF v_student.class='Working' THEN IF v_student.Dev_2000 <50 THEN grade:='FAIL';
ELSE grade:='PASS';
END IF;
elsif v_student.class='Student' THEN IF v_student.Dev_2000 >=80 THEN grade:='HONOURS';
elsif v_student.Dev_2000 >=60 THEN grade:='A';
elsif v_student.Dev_2000 >=50 THEN grade:='B';
elsif v_student.Dev_2000 >=40 THEN grade:='C';
ELSE grade:='B';
END IF;
END IF;
INSERT INTO Dev_2000_result
VALUES(v_student.Roll_no,
v_student.Oracle,
v_student.Dev_2000,
grade);
END LOOP;
END;
/