Cursor 6
Cursor 6
Assignment 6
Title: Cursors: (All types: Implicit, Explicit, Cursor FOR Loop,
Parameterized Cursor)
BEGIN
UPDATE student
SET marks = 40
IF sql%notfound THEN
ELSE
END IF;
END;
r nam mar
ol e ks
l
1
0 Alice 85
1
1
0 Bob 72
2
1
Charl
0 60
ie
3
r
na mar
ol
me ks
l
1
0 Bob 72
2
2.Write an anonymous code block to demonstrate use of explicit cursor, for loop &
parametrized explicit cursor. Copy the content of student table to another table.
Before copying, check whether second table consists of same roll number record.
If so, discard it otherwise copy it.
DECLARE
CURSOR c_student IS
FROM student;
v_roll student.roll%TYPE;
v_name student.name%TYPE;
v_marks student.marks%TYPE;
BEGIN
OPEN c_check_roll(student_rec.roll);
IF c_check_roll%FOUND THEN
dbms_output.put_line('yayy found');
ELSE
END IF;
CLOSE c_check_roll;
END LOOP;
END;
r
nam mar
ol
e ks
l
1
0 Bob 72
2
1
0 Alice 85
1
1
Charl
0 60
ie
3