触发器无效且未通过重新确认?
新建一张表 operatorFile
create 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订单','张康')
总报错:触发器无效且未通过重新确认?
难道是触发器有问题?
------解决方案--------------------
Trigger 写的有问题,编译没通过,所以找不到trigger
写成::NEW.oid
SQL code
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;