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), 6, 2) month,
         substr(max(t.time), 9, 2) day,
         round(avg(temperature1), 2) temperature1,
         round(avg(humidity1), 2) humidity1,
         round(avg(temperature2), 2) temperature2,
         round(avg(humidity2), 2) humidity2,
         round(avg(temperature3), 2) temperature3,
         round(avg(humidity3), 2) humidity3,
         round(avg(temperature4), 2) temperature4,
         round(avg(humidity4), 2) humidity4,
         round(avg(temperature5), 2) temperature5,
         round(avg(humidity5), 2) humidity5,
         round(avg(temperature6), 2) temperature6,
         round(avg(humidity6), 2) humidity6,
         round(avg(temperature7), 2) temperature7,
         round(avg(humidity7), 2) humidity7,
         round(avg(temperature8), 2) temperature8,
         round(avg(humidity8), 2) humidity8,
         round(avg(temperature9), 2) temperature9,
         round(avg(humidity9), 2) humidity9,
         round(avg(temperature10), 2) temperature10,
         round(avg(humidity10), 2) humidity10
    from originaldata t, warehouse_new w
   where t.id = w.client_id
     and t.time <= in_date
   group by t.id;
  commit;
exception
  when others then
    v_retCode := sqlcode;
    v_retMsg  := sqlerrm || sysdate;
    insert into operationlog
      (id, time, behavior, state, reason)
    values
      (operationlog_id_seq.nextval,
       to_char(sysdate, 'yyyy-mm-dd hh24:mi:ss'),
       '生成报表数据',
       0,
       v_retMsg);
    commit;
end proc_generate_report;

PROCEDURE_监测系统_原始数据报表数据生成存储过程—求每天平均值插入多表视图的更多相关文章

  1. PROCEDURE_监测系统_数据备份存储过程—备份原始数据,每十分钟一条,取平均值

    create or replace procedure proc_backup_originaldata(retCode out varchar2, -- 返回码                    ...

  2. PROCEDURE_监测系统_告警信息存储过程—产生告警信息插入告警表

    create or replace procedure proc_alarmlog(in_id   in number, --采集器编码                                 ...

  3. TRIGGERS_监测系统_原始数据表触发器—调用告警信息存储过程

    //每次向originaldata表中插入数据就会触发该触发器 create or replace trigger originaldata_to_alarm  after insert on ori ...

  4. TRIGGERS_监测系统_多表视图触发器—向原始数据报表中插入数据

    Create Or Replace Trigger trg_view_report  Instead Of Insert or update or delete on view_for_report  ...

  5. 【百度地图API】建立全国银行位置查询系统(四)——如何利用百度地图的数据生成自己的标注

    原文:[百度地图API]建立全国银行位置查询系统(四)--如何利用百度地图的数据生成自己的标注 摘要: 上一章留个悬念,"如果自己没有地理坐标的数据库,应该怎样制作银行的分布地图呢?&quo ...

  6. 『TensorFlow』SSD源码学习_其四:数据介绍及TFR文件生成

    Fork版本项目地址:SSD 一.数据格式介绍 数据文件夹命名为VOC2012,内部有5个子文件夹,如下, 我们的检测任务中使用JPEGImages文件夹和Annotations文件夹. JPEGIm ...

  7. 大数据技术之_25_手机APP信息统计系统项目_01_APP 数据生成模块 + 数据收集模块 + 数据处理模块框架搭建 + 业务需求处理 + 数据展示模块 +项目总结 + 问题总结

    一 项目概述1.1 角色1.2 业务术语1.3 项目效果展示二 项目需求三 项目概要3.1 项目技术架构3.2 项目目录结构3.3 项目技术选型3.4 项目整体集群规划3.5 创建项目工程四 APP ...

  8. MIS系统中的报表测试

    报表功能的基本要求,就是通过查询/统计/分析,提供用户所需的准确的数据.如果无法实现这个基本功能,则报表完全失去意义. 对于用户来说,报表可以直接影响到他们的决策,例如可能因为报表对销售和库存情况反映 ...

  9. 10.4 android输入系统_框架、编写一个万能模拟输入驱动程序、reader/dispatcher线程启动过程源码分析

    1. 输入系统框架 android输入系统官方文档 // 需FQhttp://source.android.com/devices/input/index.html <深入理解Android 卷 ...

随机推荐

  1. 【干货】.NET开发通用组件发布(三) 简易数据采集组件

    组件介绍和合作开发 http://www.cnblogs.com/MrHuo/p/MrHuoControls.html 简易数据采集组件 怎么说他是一个简易的数据采集组件呢?因为由于时间仓促,缺少从某 ...

  2. pyqt5模块

  3. Http GET、Post方式的请求总结

    读取http响应信息,并返回响应体 /// <summary> /// 读取http响应信息,并返回响应体 /// </summary> /// <param name= ...

  4. 远程调试 Azure 上的 Website

    让我们先检查一下使用的 Azure SDK 版本和 Visual Studio 版本.根据MSDN的介绍,Azure 的远程调试功能是在 Azure SDK 2.2 中加入的,所以请确保您的机器上安装 ...

  5. Windows 8.1 with update 官方最新镜像汇总(全)

    Windows 8.1 with update 官方最新镜像汇总,发布日期: 2014/12/16,Microsoft MSDN. 镜像更新日志: 12/29:32位大客户专业版中文版12/24:64 ...

  6. Friendly number

    Friendly number Long numbers can be made to look nicer, so let’s write some code to do just that. Yo ...

  7. haproxy 负载elasticsearch 切换

    Attempted to send a bulk request to Elasticsearch configured at '["http://192.168.32.152:9200&q ...

  8. 【POJ1003】Hangover(二分搜索)

    直接用库函数二分即可. #include <iostream> #include <cstring> #include <cstdlib> #include < ...

  9. linux下面测试网络带宽 (转载)

    利用bmon/nload/iftop/vnstat/iptraf实时查看网络带宽状况 一.添加yum源方便安装bmon# rpm -Uhv http://apt.sw.be/redhat/el5/en ...

  10. facl笔记

    文件系统访问列表:tom:    tom, tom基本组jerry: other:r-- chown FACL:Filesystem Access Control List利用文件扩展保存额外的访问控 ...