需求:有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;
解决方案 »
- 蛋疼的Oracle11gR2安装之旅,求各位大侠指点。
- oracle clob字段含有中文的xml文件如何读取?
- 关于DATE格式问题~!!!!!
- 请问 select to_char(empno,'c99999') from emp;是什么意思,
- Oracle函数的例子,把例子运行一遍,你会学到点东西哈!快乐就好!我刚边学边写的。
- sql错误定位
- Oracle有没有象MsSQL2K样数据迁移呢?
- ddl问题请教
- 远程登陆时,这两种验证方式有区别么?
- Oracle单行子查询返回多于一个行
- 由于系统错误 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;