需求:有zhd_wano_pi_value0, zhd_wano_pi_value1 两张表,当zhd_wano_pi_value0表增加一条记录时,我需要计算zhd_wano_pi_value0某个字段的平均值,然后再将平均值写入到zhd_wano_pi_value1表中,请问这个触发器该怎么写?create or replace trigger PI_TRIG
after insert on zhd_wano_pi_value0
for each row
declare
-- local variables here
begin
这个主体部分该怎么写啊...
end PI_TRIG;
after insert on zhd_wano_pi_value0
for each row
declare
-- local variables here
begin
这个主体部分该怎么写啊...
end PI_TRIG;
解决方案 »
- oracle怎么获取倒数第五个字符
- oracle 10g安装到85%时报错
- [讨论]使用存储过程得到字符串‘ABCD’的全部排列组合
- oracle中procedure调试正常执行报错
- oracle触发器编译错误问题???
- v$SQL 中怎么不是所有的SQL操作?
- oralce9i 导入导出数据求高手指教,小弟不胜感激
- 小弟有个问题请教诸位~~~关于存储过程
- oracle9i For Solaris 8安装的时候数据库实例不能创建
- 急,有人碰到这个问题没有?
- 由于系统错误 5 (Oracle in OraHome92),指定驱动程序无法加载
- as5上安装oracle10g无法通过,让配置静态ip
set column1=(select avg(column2) from zhd_wano_pi_value0 where ......)
after insert on zhd_wano_pi_value0
declare
v_temp number;
begin
select avg(col) into v_temp from zhd_wano_pi_value0;
insert into zhd_wano_pi_value1(col2) values (v_temp);
end;
after insert on zhd_wano_pi_value0
declare
v_temp number;
begin
select avg(col) into v_temp from zhd_wano_pi_value0;
update zhd_wano_pi_value1 set col2 = v_temp;
end;