Tuesday, February 7, 2017

Implicit Explicit Cursors

declare
X number(10);
Y Varchar2(10);
begin
Select * into Y,X from XXX_test where ID=&ID;-- Implicit Cursor(the Implicit Cursor generally fetches only 1 record by the system)
dbms_output.put_line(X||Y);
end;

declare
X number(10);
Y Varchar2(20);
Cursor C1 is select * from XXX_test;
begin
open C1;
loop
fetch C1 into Y,X ;--(Explicit Cursor helps to fetch multiple records , one at a time)
exit when C1%notfound;
dbms_output.put_line(Y||X);
end loop;
end;

No comments:

Post a Comment