1:创建临时表,并按一定的数据create table ZXX.TEST_TIME( T_TIME VARCHAR2(50), T_STATUS VARCHAR2(1))插入数据如:insert into ZXX.TEST_TIME values('2013-08-08 00:00:00','0');T_STATUS 初始都为0
2:创建存储过程create or replace procedure pro_import_clmxxas v_now_time number; --记录当前时间 type rec is table of clmxx_3%rowtype;--can not sa.clmxx_3%rowtype; --定义数据类型 recs rec; --申明数组 cursor c_exec_time is select * from zxx.test_time where t_status='0' and rownum < 2;--申明显示游标 type c_clmxx is ref cursor; --申明动态游标 l_c_clmxx c_clmxx;begin v_now_time :=to_number(to_char(sysdate,'hh24')); ----记录当前时间的小时来判断是晚上还是白天 if (v_now_time > 17) or (v_now_time < 7) then for r_exec_time in c_exec_time loop update zxx.test_time set t_status='2' where t_time=r_exec_time.t_time; --锁定正在导入数据,防止后启动存储再次执行 commit; open l_c_clmxx for select * from sa.clmxx_3 where jgsj >= to_date(r_exec_time.t_time,'yyyy-mm-dd hh24:mi:ss') and jgsj < to_date(r_exec_time.t_time,'yyyy-mm-dd hh24:mi:ss')+1; --打开动态游标 while (true) loop fetch l_c_clmxx bulk collect into recs limit 1000;--每次存放1000个记录到数组中 forall i in 1 .. recs.count insert into sa.clmxx values recs(i);--插入数组中的数据 commit; exit when l_c_clmxx%notfound; end loop; close l_c_clmxx; update zxx.test_time set t_status='1' where t_time=r_exec_time.t_time;--更新status状态 commit; end loop; end if;end;
3:创建jobdeclarejob number;begin --每30分钟执行一次 sys.dbms_job.submit(job,'pro_import_clmxx;',sysdate,'sysdate+30/1440');end;job详细信息,参考我的经验:http://jingyan.baidu.com/article/a3761b2bbbdd2f1577f9aa75.html
4:验证以上步骤创建完成之后,一定要验证是否导入数据
- 1
一定时间段内并发导入数据(oracle动态游标使用)
- 2
如何查询芝麻信用芝麻分
- 3
教育部学历证书电子注册备案表怎么查
- 4
怎样做芝麻花生素薄餐煎饼小吃零食
- 5
每天15个芝麻粒教程
- 6
怎么查看芝麻信用分
- 7
芝麻分到底是什么
- 8
手工如何制作芝麻糯米饼
- 9
手工炒黑芝麻并制作黑芝麻糊简便方法
- 10
如何提高芝麻信用的芝麻分
- 11
芝麻分是什么,芝麻分如何使用
- 12
脱发吃黑芝麻有效果吗
- 13
电大毕业证书怎么网上查询
- 14
没那么讲究的芝麻核桃红枣
- 15
炒出浓香的黑芝麻
- 16
黑芝麻怎么弄
- 17
怎么更好的吃芝麻
- 18
吃黑芝麻有什么好处?
- 19
夏天食芝麻 变身白皙大美人
- 20
怎样炒芝麻——闻喷香吃脆香不苦(步骤方法)
- 21
小孩子超喜欢的黑芝麻幼儿糯米版
