create or replace trigger test_trigger
before insert on test
for each row
declare
has_count integer;
begin
select count(*) into has_count
from test
where state in ( '0 ', '1 ')
and key = :new.key
and rownum = 1;
if has_count > 0
raise_application_error (-2000, '此号码不允许录入 ');
end if;
end;
表test有key和state两个字段
向表中插值时报错:“trigger 'YWZC.TEST_TRIGGER ' is invalid and failed re-validation”
请教各位了,类似这样trigger * is invalid and failed re-validation 的错误怎么解决?
------解决方法--------------------------------------------------------
You can do this in Oracle9i using the command:
ALTER SYSTEM SET "_system_trig_enabled "=FALSE;
------解决方法--------------------------------------------------------
trigger * is invalid and failed re-validation
if 语句少了then吧
------解决方法--------------------------------------------------------
这样没用吧!你判断重复就触发,触发完了还是会insert进去的。
触发器不能阻止操作。