--创建新增本地数据库的存储过程
create or replace
procedure pro_electric_record as
  begin
    insert into electric_meter_record(id,basestation_id,name,meter_number,createtime,electric_meter_id)
    select sys_guid(),substr(s.sname,0,36),s.sname,s.svalue,sysdate,(select e.id from electric_meter e where e.basestation_id=substr(s.sname,0,36)) from rtdbvs s where s.sname like '%POWER_DQDL%';
    commit;
  end;
--拼接另一张表中的值
select sys_guid(),substr(s.sname,0,36),s.sname,s.svalue,sysdate from rtdbvs s where s.sname like '%POWER_DQDL%';
--查看存储过程
select * from user_source where type='PROCEDURE'
--删除存储过程
drop procedure pro_electric_record

--dbms_scheduler创建job调度
--查询
select * from dba_scheduler_jobs;
--创建job
begin
  dbms_scheduler.create_job(
  job_name=>'electric_meter_record_insert',
  job_type=>'STORED_PROCEDURE',
  job_action=>'pro_electric_record',
  start_date=>sysdate,
  repeat_interval=>'FREQ=MINUTELY;BYSECOND=0',
  comments=>'电表录入表',
  auto_drop=>false
  );
end;
--删除定时器
begin
dbms_scheduler.drop_job(job_name => 'ELECTRIC_METER_RECORD_INSERT',force => TRUE);
end;
--启用定时器
begin
dbms_scheduler.enable('ELECTRIC_METER_RECORD_INSERT');
end;
--运行定时器
begin
dbms_scheduler.run_job('ELECTRIC_METER_RECORD_INSERT',TRUE);
end;

--重点(查询N张表中的数据存储到本地一张表中)
insert into electric_meter_record(id,basestation_id,name,meter_number,createtime)
    select sys_guid(),substr(s.sname,0,36),s.sname,s.svalue,sysdate from rtdbvs s where s.sname like '%POWER_DQDL%';

效果图:

oracle定时器,调用存储过程,定时从n张表中取值新增到本地一张表中的更多相关文章

  1. oracle 定时器调用存储过程

    转载请说明出处:http://t22011787.iteye.com/blog/1112745 一.查询系统中的job,可以查询视图 --相关视图 select * from dba_jobs; se ...

  2. Oracle定时器调用存储过程

    1. 创建表 create table job_table(run_time date); 2. 创建存储过程 create or replace procedure job_proc is begi ...

  3. 连接英文字符集的ORACLE和调用存储过程问题及64位服务器连接ORACLE问题

    部署在IIS上的webservice连接英文字符集的ORACLE数据库出现问题“未在本地计算机上注册"MSDAORA.1"提供程序”,解决方案如下: 原因:如错误,64位系统未注册 ...

  4. MySQL 开启事件 使用定时器调用存储过程

      mysql定时器是系统给提供了event,而oracle里面的定时器是系统给提供的job.废话少说,下面创建表:create table mytable (id int auto_incremen ...

  5. Mysql 简单的使用定时器调用存储过程

    1.创建测试的表 CREATE TABLE mytable (    id INT auto_increment NOT NULL,    NAME VARCHAR (100) NOT NULL DE ...

  6. java通过JDBC连接Oracle并调用存储过程和存储方法

    初始配置:电脑安装oracle 11g(这里也可使是其它版本也可,此教程演示为11g),java环境,eclipse,oracle关于jdbc的jar包. 一,在scott用户下首先要有存储过程和存储 ...

  7. Oracle job调用存储过程

    在PL/SQL中的what值中直接写入存储过程的名称+“分号”: begin sys.dbms_job.submit(job => :job, what => 'del_ky_items; ...

  8. oracle授予调用存储过程权限

    参考 https://blog.csdn.net/h254532693/article/details/45364317 grant execute on PROCEDURENAME to USERN ...

  9. oracle -sqlplus 调用存储过程

    sp.batsqlplus user/passwd/sid  @.\sp.sql >sp.sqlexit; sp.sqlexex xxxx()quit;

随机推荐

  1. Mysql中mysqldump命令使用详解

    MySQL有很多可以导入数据的方法,然而这些只是数据传输中的一半,另外的一般是从MySQL数据库中导出数据.有许多的原因我们需要导出数据.一个重要的原因是用于备份数据库.数据的造价常常是昂贵的,需要谨 ...

  2. PHP中逻辑运算符and/or与||/&&的一个坑

    我原来以为PHP中的and和&&是一样的, 只是写法上为了可读性和美观, 事实上我错了. 这里面深藏了一个坑! 看以下代码: $bA = true; $bB = false; $b1  ...

  3. 有关Highchart的那些事。。。备份一段(稍后修改)

    $(function () { $('#CurrentFinanceChart').highcharts({ title: { text: '' }, xAxis: { type: 'datetime ...

  4. Roslyn词法分析器初使用

    需:install-package:Microsoft.CodeAnalysis ];         NamespaceDeclarationSyntax NameSpaceDeclaration  ...

  5. lwfs指定特定目录输出

    在特定节点启lwfs服务,输出特定的目录 在[root@devcpucs ~]# 节点启lwfs服务,输出指定目录/home/export/online1/systest/swcpucs 1.将gio ...

  6. 繁华模拟赛day8 字典序

    /* 这个题要我们求一个字典序,字符串给出的顺序,会对字母的字典序前后相对顺序进行限定,如何用来表示这种限定,我们注意到这种一个之后接着一个,只有先输出他前面的才能输出他,很明显就是拓扑排序,最小方案 ...

  7. CentOS-6.5安装zabbix2.4.4

    使用epel源  (检查网络连接是否正常)   //这里使用epel源 [root@localhost /]# wget -O /etc/yum.repos.d/CentOS-Base.repo ht ...

  8. 联不上网 Unable to initialize Windows Sockets interface. General failure.

    电脑莫名联不上网 Unable to initialize Windows Sockets interface. General failure. Unable to initialize the W ...

  9. iOS开发——源代码管理——git(分布式版本控制和集中式版本控制对比,git和SVN对比,git常用指令,搭建GitHub远程仓库,搭建oschina远程仓库 )

    一.git简介 什么是git? git是一款开源的分布式版本控制工具 在世界上所有的分布式版本控制工具中,git是最快.最简单.最流行的   git的起源 作者是Linux之父:Linus Bened ...

  10. union联合体

    今天笔试的一道题,好久没用union了,竟然忘光光了. 关于其大小的计算,分两步:先算对齐大小(成员中字节最大的那个),再算分配空间: 不仅是对齐大小的整数倍,还要满足实际大小不能小于最大成员大小. ...