1.自定义异常说明
declare
e_insert_excep exception;
pragma exception_init(e_insert_excep,-1400);
begin
insert into departments(department_id,department_name) values(280,null);
exception when e_insert_excep then
dbms_output.put_line('Insert operation failed');
dbms_output.put_line(sqlerrm);
end;
执行结果:
Insert operation failed
ORA-01400: 无法将 NULL 插入 ("HR"."DEPARTMENTS"."DEPARTMENT_NAME")
Exception
最新推荐文章于 2023-05-15 21:56:49 发布