January 3, 2013

PL Sql program example of cursor on employee table

This is a PL Sql program example of cursor on employee table to check whether employee exist or not.

declare
v_empno emp.empno%type:=&gempno;
cursor empcursor
is
select *
from emp
where empno=v_empno;
v_empcursor empcursor%rowtype;
begin
open empcursor;
fetch empcursor into v_empcursor;
if empcursor%found then
dbms_output.put_line('v_empcursor.ename);
else
dbms_output.put_line('sorr..! no employee exists..');
end if;
end;

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.