TRIGGERS_监测系统_原始数据表触发器—调用告警信息存储过程
//每次向originaldata表中插入数据就会触发该触发器
create or replace trigger originaldata_to_alarm
after insert on originaldata
for each row
declare
v_temperature num_array := num_array(1, 0);
v_humidity num_array := num_array(1, 0);
v_concentration num_array := num_array(1, 0);
begin
v_temperature.extend(10);
v_humidity.extend(10);
v_concentration.extend(3);
v_temperature(1) := :new.temperature1;
v_temperature(2) := :new.temperature2;
v_temperature(3) := :new.temperature3;
v_temperature(4) := :new.temperature4;
v_temperature(5) := :new.temperature5;
v_temperature(6) := :new.temperature6;
v_temperature(7) := :new.temperature7;
v_temperature(8) := :new.temperature8;
v_temperature(9) := :new.temperature9;
v_temperature(10) := :new.temperature10;
v_humidity(1) := :new.humidity1;
v_humidity(2) := :new.humidity2;
v_humidity(3) := :new.humidity3;
v_humidity(4) := :new.humidity4;
v_humidity(5) := :new.humidity5;
v_humidity(6) := :new.humidity6;
v_humidity(7) := :new.humidity7;
v_humidity(8) := :new.humidity8;
v_humidity(9) := :new.humidity9;
v_humidity(10) := :new.humidity10;
v_concentration(1) := :new.concentration1;
v_concentration(2) := :new.concentration2;
v_concentration(3) := :new.concentration3;
--调用存储过程
proc_alarmlog(:new.id,:new.ipcode,:new.time,v_temperature,v_humidity,v_concentration);
end originaldata_to_alarm;