Oracle/PL/SQL
15일차 # 8-16: [3] when others then
Bohemian life
2012. 4. 24. 21:55
drop table t1 purge;
create table t1 (no number not null);
create or replace procedure up_exceptions3(a number)
is
begin
insert into t1 values (a);
end;
/
exec up_exceptions3(100)
exec up_exceptions3(null) --> 에러: ORA-01400: NULL을 ("TOP20"."T1"."NO") 안에 삽입할 수 없습니다
↓ ↓ ↓
create or replace procedure up_exceptions3(a number)
is
begin
insert into t1 values (a);
exception
when others then
p('알 수 없는 문제가 발생하였사옵니다, 주인님!');
p(sqlcode);
p(sqlerrm);
end;
/
exec up_exceptions3(null)