首页 > 数据库技术 > 详细

Oracle存储过程function语法及案例

时间:2014-07-24 22:46:03      阅读:408      评论:0      收藏:0      [点我收藏+]
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 = methen
  
    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 = 4001and ts.me <> 0
               and ts.iyeriod = substr(replace(statdate, -‘, ‘‘), 1, 6));
    return v_me;
  
  elsif para = mbthen
    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) || 01and t.citem_id in
           (select distinct (ts.citem_id)
              from sx03_gl_accass ts
             where ts.ccode = 4001and ts.mb <> 0
               and ts.iyeriod = substr(statdate, 1, 4) || 01);
    return v_mb;
  end if;

end;

Oracle存储过程function语法及案例,布布扣,bubuko.com

Oracle存储过程function语法及案例

原文:http://www.cnblogs.com/liudi1992/p/3866429.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!