--创建新增本地数据库的存储过程
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. 文件操作 fopen() fclose()

    #define _CRT_SECURE_NO_DEPRECATE /*取消scanf,printf不安全之类的错误提示*/ /* fopen example */ #include <stdio ...

  2. ACM3 求最值

    /*2*2014.11.18*求最值*描述:给定N个整数(1<=N<=100),求出这N个数中的最大值,最小值.*输入:多组数据,第一行为一个整数N,第二行为N个不超过100的正整数,用空 ...

  3. Codeforces 675C Money Transfers 思维题

    原题:http://codeforces.com/contest/675/problem/C 让我们用数组a保存每个银行的余额,因为所有余额的和加起来一定为0,所以我们能把整个数组a划分为几个区间,每 ...

  4. MAC地址,使用java获取IP地址和MAC地址。

    MAC地址,通常在http连接的项目中,来区分唯一客户端. MAC:六组十六进制字符组成. 如:E0-3F-49-AB-DB-EB IP:四组八位的二进制字符组成. 如:10.6.62.244 /** ...

  5. 理解js中this的指向

         学习自原文  http://www.cnblogs.com/pssp/p/5216085.html后的一点小结(原文作者总结的很棒^_^)! 关于js中this的指向,在函数定义的时候还无法 ...

  6. Caffe学习系列(8):solver及其配置

    solver是caffe的核心. net: "examples/mnist/lenet_train_test.prototxt" test_iter: 100 test_inter ...

  7. linux kernel i2c底层代码跟踪

    其实跟上次跟的平台总线有关 在arch/arm/mach-mx6/board-mx6q_sabresd.c 文件中 static void __init mx6_sabresd_board_init( ...

  8. win7和ubuntu双系统删除ubuntu的方法

    双系统,一般是先安装win7,再装ubuntu,开机用grub引导.假如装完双系统,某一天又想恢复使用windows怎么办呢? 也许你会说,直接用win7的磁盘管理工具,格式化ubuntu所在磁盘不就 ...

  9. POJ 2195 Going Home 最小费用最大流 尼玛,心累

    D - Going Home Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Subm ...

  10. postgresql 函数&存储过程 ; 递归查询

    函数:http://my.oschina.net/Kenyon/blog/108303 紧接上述,补充一下: 输入/输出参数的函数demo(输入作为变量影响sql结果,输出作为结果返回) create ...