Professional Documents
Culture Documents
Exec Ption
Exec Ption
Exec Ption
Roll no ----- 06 CREATE OR REPLACE PROCEDURE error_proc AS n number; n_great exception; BEGIN n:=5; if(n>4) then raise n_great; else dbms_output.put_line('n is less then to 4'); end if; exception when n_great then dbms_output.put_line('n is greater then to 5'); END; set serveroutput on; execute error_proc;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
/////////////////////////////////// create table exception_amar(sals_no number(5), sals_target number(7), commission number(5), salary number(6)); desc exception_amar
insert into exception_amar values(11, 200, 5, 3000); insert into exception_amar values(12, 500, 7, 3000); insert into exception_amar values(13, 700, 9, 3000); insert into exception_amar values(14, 900, 11, 3000); select * from exception_amar;
CREATE OR REPLACE PROCEDURE error_proc AS salesman_no exception_amar.sals_no%type; target exception_amar.sals_target%type; comm exception_amar.commission%type; sal exception_amar.salary%type; n number(5); error_exp exception; BEGIN select sals_no into n from execption_amar where sals_target<=700 RAISE error_exp; EXCEPTION when error_exp then insert into exception_amar(sal, salary+(salary*0.4)); END;
Type
SALS_NO 11 12 13
COMMISSION 5 7 9
14
900
11
3000
/////////////////////////////////////////////////////111111111111111111111111///////////////////