作为PL / sql中的新手,我一直在复制和粘贴以下触发器:
CREATE OR REPLACE TRIGGER FOO_TRG1 BEFORE INSERT ON FOO REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW BEGIN IF :NEW.FOO_ID IS NULL THEN SELECT FOO_SEQ1.NEXTVAL INTO :NEW.FOO_ID FROM DUAL; END IF; EXCEPTION WHEN OTHERS THEN RAISE; END FOO_TRG1; / ALTER TRIGGER FOO_TRG1 ENABLE;
是的,这个异常什么也不做,但是提出相同的错误.它也用于屏蔽错误的真实行号.如果我是你,我会删除
原文链接:https://www.f2er.com/oracle/205593.html例如:
sql> declare 2 v number; 3 begin 4 select 1 into v from dual; 5 select 'a' into v from dual; 6 exception 7 when others 8 then 9 raise; 10 end; 11 / declare * ERROR at line 1: ORA-06502: PL/sql: numeric or value error: character to number conversion error ORA-06512: at line 9
VS:
sql> declare 2 v number; 3 begin 4 select 1 into v from dual; 5 select 'a' into v from dual; 6 end; 7 / declare * ERROR at line 1: ORA-06502: PL/sql: numeric or value error: character to number conversion error ORA-06512: at line 5
第一行中的行号指向加注而不是实线号.它可以使跟踪错误更难.