我写了个触发器。目的就是在PO表中更新或者插入操作之前触发,插入或者更新到HTZXQK表中,但是有问题,我不知道处在那里了,请高手们帮忙看看,小弟在此谢过,
create or replace trigger "update_htzxqk"
before insert or update or delete
on "PO"
for each row
begin if inserting then insert into HTZXQK(xmbh,htbh) select po.jhbh,po.htbh from po elsif updating then update HTZXQK set htbh=po.htbh,xmbh=po.xmbh where htbh=htzxqk.htbh
end if; end;
create or replace trigger "update_htzxqk"
before insert or update or delete
on "PO"
for each row
begin if inserting then insert into HTZXQK(xmbh,htbh) select po.jhbh,po.htbh from po elsif updating then update HTZXQK set htbh=po.htbh,xmbh=po.xmbh where htbh=htzxqk.htbh
end if; end;
解决方案 »
- 求助: Oralce Clob带符号的字符匹配
- windows 下不装客户端可以访问linux下的oracle 10g OEM 吗
- 触发器 无效且未通过重新验证
- 数据库遇到重大疑难问题...
- 两个语句执行一个,怎么个回滚法?
- win 2003 oracle 10.2G CRS RAC (一个气的吐血的问题)
- 请教一个SQL文的写法
- C++ BUILDER 6 往ORACLE9I数据库里写数据出现乱码的问题——急!
- 为什么我在存储过程中使用dba_free_spaces之类的视图时,oracle总提示没有定义的变量?
- 关于字段问题!
- 十万火急!项目急用!请问存储过程出错解决策略?
- 那位老兄帮个忙:非法的 ALTER TABLE 选项
发生编号:4098的数据库错误。
请与系统管理员联系寻求帮助。ORA-04098:触发器'MAXIMO.PO_T_INSERT'无效且未通过验证
before insert or update or delete
on "PO"
for each row
begin if inserting then insert into HTZXQK(xmbh,htbh) select new.jhbh,new.htbh from po elsif updating then update HTZXQK set htbh=new.htbh,xmbh=new.xmbh where htbh=new.htbh
end if; end;
这样改下看看
INSERT
OR UPDATE
OR DELETE ON "PO" FOR EACH ROW begin
case
when inserting then
insert into HTZXQK (xmbh,htbh) values (: new .jhbh,: new .htbh);
end case ;
end ;帮忙看看吧,小弟刚用ORACLE1天根本不会,时间不允许让我去看书,只能看点语法凑合写出来。帮帮忙吧
VALUES(:new.row_id,:new.col1, :new.col2); elsif updating then update niu_b set col1=:new.col1,col2=:new.col2 where row_id =:new.row_id;
end if;
INSERT
OR UPDATE
OR DELETE ON "PO" FOR EACH ROW begin
case
when inserting then
insert into HTZXQK (xmbh,htbh) values (: new .jhbh,: new .htbh);
end case ;
end ; 改成这样看看CREATE OR REPLACE TRIGGER "WX_UPDATE" AFTER
INSERT
OR UPDATE
OR DELETE ON PO FOR EACH ROW
begin
if inserting then
insert into HTZXQK (xmbh,htbh) values (:new.jhbh,:new.htbh);
--elsif updating then
--update niu_b set col1=:new.col1,col2=:new.col2 where row_id =:new.row_id;
end;
end ;
before insert or update or delete
on APPS.niu_a
for each row
begin
if inserting then
insert into niu_b(row_id,col1,col2) --select col1,col2 from niu_a ;
VALUES(:new.row_id,:new.col1, :new.col2);
elsif updating then
update niu_b set col1=:new.col1,col2=:new.col2 where row_id =:new.row_id;
end if;
end;
参照一下把
害死人阿。全角逗号阿~
before insert or update or delete
on "PO"
REFERENCING OLD AS OLD NEW AS NEW
for each row
begin if inserting then insert into HTZXQK(xmbh,htbh) select new.jhbh,new.htbh from dual elsif updating then update HTZXQK set htbh=new.htbh,xmbh=new.xmbh where htbh=new.htbh
end if; end;