This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: 2 3 v_dept Department.code%TYPE 4 v_count Department.totalfaculty%TYPE 5 CURSOR ctotal is 6 SELECT dept,count(dept) FROM faculty GROUP BY dept 7 8 BEGIN 9 OPEN ctotal 10 LOOP 11 UPDATE Department SET totalfaculty = v_count WHERE code = v_dept 12 FETCH ctotal INTO v_dept, v_count 13 Exit when ctotal%NOTFOUND 14 dbms_output.put_line(' Department: '|| v_dept || ' Has ' || v_count || Number of people as Faculty') 15 END LOOP 16 CLOSE ctotal Procedure created. Sheet1 Page 2 13) SQL> update department set totalfaculty = v_count where code = v_dept 14) SQL> CREATE OR REPLACE TRIGGER faculty_after_insert_row 2 AFTER INSERT ON facultyEDB FOR EACH ROW 3 BEGIN 4 UPDATE Department d SET totalfaculty = totalfaculty+1 WHERE d.code = :ne w.dept 5 END 05/06/09 Trigger created....
View Full Document
This note was uploaded on 09/08/2008 for the course CSIS 3310 taught by Professor Guimares during the Spring '08 term at Kennesaw.
- Spring '08