随笔分类 -  PLSQL实例

TRIGGERS_监测系统_多表视图触发器—向原始数据报表中插入数据
摘要: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) 阅读全文

posted @ 2013-08-02 18:12 世界之大追梦者 阅读(276) 评论(0) 推荐(0)

PROCEDURE_监测系统_原始数据报表数据生成存储过程—求每天平均值插入多表视图
摘要: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) 阅读全文

posted @ 2013-08-02 18:09 世界之大追梦者 阅读(208) 评论(0) 推荐(0)

PROCEDURE_监测系统_数据备份存储过程—备份原始数据,每十分钟一条,取平均值
摘要: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 阅读全文

posted @ 2013-08-02 18:04 世界之大追梦者 阅读(264) 评论(0) 推荐(0)

TRIGGERS_监测系统_原始数据表触发器—调用告警信息存储过程
摘要://每次向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 阅读全文

posted @ 2013-08-02 17:53 世界之大追梦者 阅读(161) 评论(0) 推荐(0)

PROCEDURE_监测系统_告警信息存储过程—产生告警信息插入告警表
摘要: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 阅读全文

posted @ 2013-08-02 17:49 世界之大追梦者 阅读(422) 评论(0) 推荐(0)

导航