zoukankan      html  css  js  c++  java
  • oracle 存储过程

    create or replace procedure p_insert_caz_lims as v_sqlcode TLIMSERRORINFO.ERROR_CODE%type; v_msg TLIMSERRORINFO.error_msg%type; begin insert into TLIMSERRORINFO (ERROR_ID, error_code, error_msg, error_date, error_program) values (SEQ_TLIMSERRORINFO.nextval, '0', '执行开始', sysdate, 'p_insert_caz_lims'); declare cursor lims_info is select zzdm, zzmc, cyd, ypmc, fxxm, r_units, qy, to_char(r_value) as r_value, to_char(r_text) as r_text, to_char(cysj) as rtime, to_char(rzsj) as dtime, batch_name, r_out_of_range, mv_range, grade from CAZ_LIMS_ALL_VIEW@DLINK_CAZ.REGRESS.RDBMS.DEV.US.ORACLE.COM where to_date(rzsj, 'yyyy-mm-dd HH24:mi:ss') > trunc(sysdate)-2 and rzsj is not null; limsstop lims_info%rowtype; DATA_COUNT number(10); begin open lims_info; loop fetch lims_info into limsstop; exit when lims_info%NOTFOUND; begin select count(id) into DATA_COUNT from tlimsoriginaldata where rtime = to_date(limsstop.rtime,'yyyy-mm-dd HH24:mi:ss') and dtime = to_date(limsstop.dtime,'yyyy-mm-dd HH24:mi:ss') and locationid = limsstop.zzdm and locationname = limsstop.zzmc and samplingpoint = limsstop.cyd and samplename = limsstop.ypmc and rname = limsstop.fxxm and qy = 'CAZ'; if DATA_COUNT = 0 then insert into TLIMSORIGINALDATA (id, locationid, locationname, samplingpoint, samplename, rname, units, qy, rvalue, rtime, dtime, batch_name, rtext, r_out_of_range, mv_range, grade) values (SEQ_TLIMSORIGINALDATA.nextval, limsstop.zzdm, limsstop.zzmc, limsstop.cyd, limsstop.ypmc, limsstop.fxxm, limsstop.r_units, limsstop.qy, limsstop.r_value, to_date(limsstop.rtime, 'yyyy-mm-dd hh24:mi:ss'), to_date(limsstop.dtime, 'yyyy-mm-dd hh24:mi:ss'), limsstop.batch_name, limsstop.r_text, limsstop.r_out_of_range, limsstop.mv_range, limsstop.grade); end if; end; end loop; close lims_info; insert into TLIMSERRORINFO (ERROR_ID, error_code, error_msg, error_date, error_program) values (SEQ_TLIMSERRORINFO.nextval, '1', '执行成功', sysdate, 'p_insert_caz_lims'); exception when others then v_sqlcode := sqlcode; v_msg := sqlerrm; insert into TLIMSERRORINFO (ERROR_ID, error_code, error_msg, error_date, error_program) values (SEQ_TLIMSERRORINFO.nextval, v_sqlcode, v_msg, sysdate, 'p_insert_caz_lims'); end; end p_insert_caz_lims;
  • 相关阅读:
    MySQL日期比较
    MySQL日期函数、时间函数总结(MySQL 5.X)
    MySQL日期、字符串、时间戳互转
    通过 zxing 生成二维码
    前台时间格式 2019-03-09T16:00:00.000Z
    基于vue-cli配置手淘的lib-flexible + rem,实现移动端自适应
    python爬虫实例大全
    python3 BeautifulSoup模块使用
    Python 通过sgmllib模块解析HTML
    如何搭建一个合理的数值框架?
  • 原文地址:https://www.cnblogs.com/xu3593/p/3884906.html
Copyright © 2011-2022 走看看