zoukankan      html  css  js  c++  java
  • Oracle存储过程function语法及案例

    create or replace function F01_SX03_SUM(statdate varchar2,
                                            code     varchar2,
                                            para     varchar2)
    
     RETURN number IS
      v_me number;
      v_mb number;
    
    begin
    
      if para = 'me' then
      
        select nvl(sum(nvl(me, 0)), 0) / 10000
          into v_me
          from sx03_gl_accass t
         where t.ccode like (code || '%')
           and t.iyeriod = substr(replace(statdate, '-', ''), 1, 6)
           and t.citem_id in
               (select distinct (ts.citem_id)
                  from sx03_gl_accass ts
                 where ts.ccode = '4001'
                   and ts.me <> 0
                   and ts.iyeriod = substr(replace(statdate, '-', ''), 1, 6));
        return v_me;
      
      elsif para = 'mb' then
        select nvl(sum(nvl(mb, 0)), 0) / 10000
          into v_mb
          from sx03_gl_accass t
         where t.ccode like (code || '%')
           and t.iyeriod = substr(statdate, 1, 4) || '01'
           and t.citem_id in
               (select distinct (ts.citem_id)
                  from sx03_gl_accass ts
                 where ts.ccode = '4001'
                   and ts.mb <> 0
                   and ts.iyeriod = substr(statdate, 1, 4) || '01');
        return v_mb;
      end if;
    
    end;
  • 相关阅读:
    k邻近
    C语言实现pwd—关于linux文件系统
    Linux多线程
    有关临时表
    毕设—线程池thread_pool(草)
    3-26
    3-25
    3-22
    关于中国神华
    3-20
  • 原文地址:https://www.cnblogs.com/liudi1992/p/3866429.html
Copyright © 2011-2022 走看看