【指标统计】删除抖动遥信
生活随笔
收集整理的這篇文章主要介紹了
【指标统计】删除抖动遥信
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
1. 創(chuàng)建遙信抖動(dòng)登記表
DROP TABLE "SMARTSYS"."scada_event_yx_shake"; CREATE TABLE "SMARTSYS"."scada_event_yx_shake" ( "START_TIME" TIMESTAMP(0) NOT NULL, "END_TIME" TIMESTAMP(0) NOT NULL, "OBJ_ID" BIGINT NOT NULL, "CNT" INTEGER default 0, "ISDEL" INTEGER default 0) STORAGE(ON "SMART_HISTORY", CLUSTERBTR);2. 查找抖動(dòng)的遙信
declarepnt_id_var bigint;start_time_var TIMESTAMP;time_1_var TIMESTAMP;time_2_var TIMESTAMP;cnt_var integer;Pcur CURSOR; begin--select min(occur_time) into start_time_var from scada_event_yx;select sysdate()-numtodsinterval(3,'day') into start_time_var from dual;OPEN Pcur FOR select distinct(obj_id) as pnt_id_var from scada_event_yx;LOOPFETCH Pcur INTO pnt_id_var;EXIT WHEN Pcur%NOTFOUND;time_1_var = start_time_var;WHILE TRUE LOOPtime_2_var = time_1_var+numtodsinterval(1,'day');IF time_1_var > sysdate() THENEXIT;END IF;select count(*) into cnt_var from scada_event_yx where obj_id = pnt_id_var and occur_time > time_1_var and occur_time < time_2_var;insert into scada_event_yx_shake(start_time,end_time,obj_id,cnt) values(time_1_var, time_2_var, pnt_id_var, cnt_var);time_1_var = time_2_var;END LOOP;END LOOP;CLOSE Pcur; end; commit;3. 查詢抖動(dòng)遙信的結(jié)果
select * from scada_event_yx_shake where cnt >= 50 order by cnt desc;4. 根據(jù)scada_event_yx_shake中的記錄,從scada_event_yx表中刪除相應(yīng)的數(shù)據(jù)。
delete from scada_event_yx where occur_time >= ? and occur_time <= ? and obj_id = ?;總結(jié)
以上是生活随笔為你收集整理的【指标统计】删除抖动遥信的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 【指标统计】统计装置总招遥信
- 下一篇: 微生物有机肥是什么?