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”
请教各位了

解决方案 »

  1.   

    You can do this in Oracle9i using the command:ALTER SYSTEM SET "_system_trig_enabled"=FALSE;
      

  2.   

    可以再问一下这个"_system_trig_enabled"变量是做什么用的吗?
      

  3.   

    我的用户权限不够,不影响其他应用的话我就找dba去
      

  4.   

    这样没用吧!你判断重复就触发,触发完了还是会insert进去的。触发器不能阻止操作。