我写了个触发器。目的就是在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;
解决方案 »
- oracle语法
- 帮忙解释下一个SQL函数的意思.
- Windows7下,如何安装Oracle10.x数据库~
- 在oracle如何优化?
- 写一个FUNCTION 或者存储过程,关于几张表的查询 有点难度,大家帮忙
- liusong_china 进~~~来解释你写的sql
- ASP连接ORACLE9i的问题
- 在SQL Server中,如果排序用倒序时,用desc表示,如order by desc id,在orcale中怎么表示呀?
- 如何中断一个ADO查询?(100分)请教了,谢谢!
- 1个数字:2,1个集合(1,2,3)。如何能用SQL语句求出在集合中不包含这个数字的其他数字?不要建表,可以实现吗?
- 十万火急!项目急用!请问存储过程出错解决策略?
- 那位老兄帮个忙:非法的 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;