User Define Exception:-
Write a Pl/Sql program to raise the employees salary by some amount & if total salary Raise is grater than 5000 then display error that This much raise is not possible.
declare
v_id number :=&empno;
v_sal number;
v_raise number :=&raise;
v_raise_sal number;
Raise_Exception Exception;
begin
select salary into v_sal from emp10
where employee_id=v_id;
v_raise_sal:=v_sal+v_raise;
if v_raise_sal > 5000 then
Raise Raise_exception;
End if;
update emp10 set salary=v_raise_sal
where employee_id=v_id;
Exception
when no_data_found then
dbms_output.put_line('There is no scuch employees');
when Raise_Exception then
dbms_output.put_line('This much raise is not possible');
End;
0 comments:
Post a Comment