PL/SQL Procedure to Check Employee Number Exist or Not

PL/SQL Procedure to Check Employee Number Exist or Not:

create or replace procedure valid_no is
not_valid exception;
no number;
begin
select count(*) into no from emp where id=4;
if(no = 0) then
raise not_valid;
else
dbms_output.put_line('Employee Number exists');
end if;
exception
when not_valid then
dbms_output.put_line('Employee Number is not valid');
end;

Calling Procedure:

begin
valid_no;
end;

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.