新建一张表 operatorFilecreate table  operatorFile
(
  Oid number primary key,
  Otime date, --操作时间
  Oname varchar2(100),--操作名称
  UserName varchar2(10)--操作人姓名  
)
oid是主键,且自动增长,create  sequence seq_operId
start with 1
increment by 1
nomaxvalue
nocycle要在程序里插入数据,所以创建了一个触发器来触发序列
create or replace trigger iagent.trig_oper before insert  on iagent.operatorfile for each row
  begin   
    select seq_operid.nextval into NEW.oid from dual;     
  end;在PL/SQL 里测试   insert into operatorfile(oid,otime,oname,username) values(seq_operid.nextval,sysdate,'跟新21323订单','张康')
 总报错:触发器无效且未通过重新确认?
难道是触发器有问题?

解决方案 »

  1.   

    insert into operatorfile(oid,otime,oname,username) values(seq_operid.nextval,sysdate,'跟新21323订单','张康') 
    已经实现自动增长的功能,删掉触发器。
      

  2.   

    Trigger 写的有问题,编译没通过,所以找不到trigger写成::NEW.oid 
    create or replace trigger iagent.trig_oper before insert  on iagent.operatorfile for each row 
      begin  
        select seq_operid.nextval into :NEW.oid from dual;    
      end; 
      

  3.   

    楼上正解tks  眼睛都看瞎勒,就是没发现 哎
      

  4.   

    我也出现这个问题了
    NEW.oid 这里的NEW写成了new也报错:触发器无效且未通过重新确认
    学习了,谢谢各位!