触发执行期间出错ORA-06512和ORA-04088

时间:2015-01-10 18:23:08

标签: sql oracle triggers

我创建了一个触发器,以便用户在CRIME表中不存在CRIME_NO时不能输入CRIME_NO。我确实收到了犯罪号码:' || :new.CRIME_NO || '不在犯罪表中的错误。

但我也收到ORA-06512:at" C3405016.EVIDENCE_FK",第8行ORA-04088:执行触发器时出错' C3405016.EVIDENCE_FK'

Create or replace trigger Evidence_fk
before insert or update of CRIME_NO
on Evidence
for each row
declare
         dummy   integer;
begin
         select count(*)    into dummy
         from Evidence
         where CRIME_NO = :new.CRIME_NO;
     if (dummy < 1) /* i.e. no corresponding Crime_No in Crime */
             then raise_application_error(-20002,
             'Crime Number: '|| :new.CRIME_NO || ' not in the Crime table');
         end if;
end;

ORA-20002:犯罪号码:20不在犯罪表ORA-06512:at&#34; C3405016.EVIDENCE_FK&#34;,第8行ORA-04088:执行触发器时出错&#39; C3405016.EVIDENCE_FK& #39;

0 个答案:

没有答案