Asp.net,SQL tips-Tricks for error resolution version 2014,2012,2008,2005,Procedural language,Stored Procedure, computer , excel macro programming,Film,Musical notations,Indian ,Western Music.

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;