Check exists validation using pl/sql
declare
v_deptno dept.deptno%type:=&gdeptno;
cursor deptcursor
is
select * from dept where deptno=v_deptno;
v_deptcursor deptcursor%rowtype;
begin
open deptcursor;
fetch deptcursor into v_deptcursor;
if deptcursor%found then
dbms_output.put_line('v_deptcursor.ename);
else
dbms_output.put_line('sorr..! no deptloyee exists..');
end if;
end;
declare
v_deptno dept.deptno%type:=&gdeptno;
cursor deptcursor
is
select * from dept where deptno=v_deptno;
v_deptcursor deptcursor%rowtype;
begin
open deptcursor;
fetch deptcursor into v_deptcursor;
if deptcursor%found then
dbms_output.put_line('v_deptcursor.ename);
else
dbms_output.put_line('sorr..! no deptloyee exists..');
end if;
end;
0 comments:
Post a Comment