摘要:
Create Or Replace Trigger trg_view_report Instead Of Insert or update or delete on view_for_report for each rowDeclarebegin If Inserting Then if :new.temperature1 <= 250 then insert into originaldata_report (id, wid, wname, jurisdiction, jurisdiction_name, year, month, day, temperature, humidity) 阅读全文
摘要:
create or replace procedure proc_generate_report(in_date in varchar2) is v_retCode varchar2(20); v_retMsg varchar2(500);begin v_retCode:= ''; v_retMsg:= ''; insert into view_for_report select t.id, max(w.wid) wid, max(w.wname) wname, substr(max(t.time), 1, 4) year, substr(max(t.time) 阅读全文
摘要:
create or replace procedure proc_backup_originaldata(retCode out varchar2, -- 返回码 retMsg out varchar2) --返回信息isv_now varchar2(20):=to_char(sysdate,'yyyy-mm-dd');cursor c_backup is select * from originaldata t where t.time <=v_now;v_filename varchar2(50):=v_now||'.txt';v_datastr va 阅读全文
摘要:
//每次向originaldata表中插入数据就会触发该触发器create or replace trigger originaldata_to_alarm after insert on originaldata for each rowdeclare 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 阅读全文
摘要:
create or replace procedure proc_alarmlog(in_id in number, --采集器编码 ip_code in number, --采集器ip in_time varchar2, --采集时间 t_arr num_array, --温度数据 h_arr num_array, --湿度数据 c_arr num_array) --二氧化碳数据is min_table num_type := num_type(0); --仓库监控阈值范围最小值 max_table num_type := num_type(0); --仓库监控阈值范围最大值 state_t 阅读全文