• Orcal存储过程


    一、Orcal存储过程语法

    --定义存储过程开始
    create or replace procedure  pm_quotaresult_tablename(
           --定义入参
           v_fundcode   in varchar2,
           v_bendyeildid     in varchar2,
           v_busidate in varchar2
    )
    AS 
           p_achievementnav  zt_tablename.achievementnav%type;--定义替换变量
           p_countnav  zt_tablename.achievementnav%type;
    BEGIN
               
          --定义游标       
          DECLARE CURSOR p_benchmark IS 
          select p.benchmarkid,p.rundate,p.resultvalue from pm_quotaresult p where p.benchmarkid = v_bendyeildid and rundate >= v_busidate order by rundate;
          
           p_benchmarkid      varchar2(50);--查询字段定义
           p_rundate      pm_quotaresult.rundate%type;--用原表的字段类型
           p_resultvalue      varchar2(50);       
     
           BEGIN 
             OPEN p_benchmark;
               LOOP
                 FETCH p_benchmark INTO p_benchmarkid,p_rundate,p_resultvalue; --开始遍历,字段于上面定义字段顺序一致
                 exit when p_benchmark%notfound;
                 --逻辑判断计算
                 if p_rundate = v_busidate then
                   p_countnav := 1 * (p_resultvalue+1) - 1;
                     DBMS_OUTPUT.put_line( p_countnav);
                   p_achievementnav := 1;
                 else
                   p_countnav := (1 + p_countnav) * (p_resultvalue+1) - 1;
                     DBMS_OUTPUT.put_line( p_countnav);
                   p_achievementnav := 1 + p_countnav;    
                 end if;
                   
                -- 3.修改tablename表中的数据
                update zt_tablename set benchyield = p_resultvalue,achievementnav = p_achievementnav where fundcode = v_fundcode and busidate = p_rundate;
                
               END LOOP;
             CLOSE  p_benchmark;
           END;
          COMMIT;
    END pm_quotaresult_tablename;

    二、执行存储过程

    call pm_quotaresult_tablename('111015','15556','20161118');
  • 相关阅读:
    CSS的z-index(分层)
    CSS的position(位置)
    HTML-答案检查&按钮倒计时
    HTML-字体逐渐显示
    2012 VS密钥
    游戏的轻度、中度、重度是什么意思
    PHP Date()函数详细参数
    服务器被黑之后的处理经历
    SEO
    ps切图步骤
  • 原文地址:https://www.cnblogs.com/zeussbook/p/13803544.html
Copyright © 2020-2023  润新知