create or replace procedure up_exceptions1(a number, b number)

is 

 v_ret number;

begin

 v_ret := a/b;

 p(v_ret);

end;

/


exec up_exceptions1(100, 10)   --> 정상 처리

exec up_exceptions1(100, 0)    --> 에러: ORA-01476: 제수가 0 입니다


↓ ↓ ↓ 


create or replace procedure up_exceptions1(a number, b number)

is 

 v_ret number;

begin

 v_ret := a/b;

 p(v_ret);

exception

 when ZERO_DIVIDE then

   p('주인님, 0으로 나누시면 안되옵나이다.');

end;

/


exec up_exceptions1(100, 10) 

exec up_exceptions1(100, 0) 


+ Recent posts