Tuesday, June 19, 2018

Using cursor display only NO,NAME of first three row without using For loop - DBMS (Cursor)

declare
cursor abc is select no,name from empmaster;
rec empmaster.no%type;
rec1 empmaster.name%type;
i number(2);
begin
open abc;
i:=1;
while i<4
loop
fetch abc into rec,rec1;
dbms_output.put_line(rec||'    '||rec1);
i:=i+1;
end loop;
close abc;
end;

No comments:

Post a Comment