Cursors
Cursors
Types of cursors
1. Implicit cursor
2. Explicit cursor
Two Important Features
1. Cursors allow you to fetch and
process rows returned by a select
statement,one row at a time.
declare
vname varchar2(20);
begin
select fname into vname from student11;
dbms_output.put_line('name is ' || vname);
end;
Cursors
ORA-01422:
exact fetch returns more than requested
number of rows
Cursors
Declare
Cursor student is Select fname from student11;
Vname student11.fname%type;
Begin
Open student;
Loop
Fetch student into vname;
Exit when student%notfound;
Dbms_output.put_line('name is' || vname);
End loop;
Close student;
end;
Cursors
Output
name is anit
name is SUNIL