create or replace procedure testProcedure3 (num IN integer) IS
studentName student.sName%TYPE; major student.major%TYPE; num1 integer;
CURSOR myCursor IS SELECT sname, major FROM Student;
CURSOR myCursor2 is SELECT * FROM newStudent FOR UPDATE;
BEGIN
  OPEN myCursor;
  -- OPEN myCursor2;
  FOR i IN 1 .. num LOOP
    FETCH myCursor INTO studentName, major;
    INSERT INTO newStudent VALUES (studentName, major);
  END LOOP;
  CLOSE myCursor;
  OPEN myCursor;
  LOOP
    FETCH myCursor2 INTO studentName, major;
    EXIT WHEN myCursor2%NOTFOUND;
    UPDATE newstudent set name = 'Dave' where current of myCursor2;
  END LOOP;
  CLOSE myCursor2;
END;
.
