Friday, May 8, 2009

Explicit cursors in PL/SQL procedures

/* Use of Explicit cursor in procedures is shown in the below example. */ Create or replace procedure SP_EMP is
cursor Emp_cur is select empno,ename from EMP;
Emp_cur_var emp_cur%RowType;
begin
open Emp_cur;
loop
Fetch Emp_cur into Emp_cur_var;
exit when Emp_cur%NotFound;
dbms_output.put_line(Emp_cur_var.empno' ' Emp_cur_var.ename);
endloop;
close Emp_cur;
end SP_EMP;

No comments: