返回一个varchar2的信息不就可以了。''就是没有错误,<>''就是错误说明。

解决方案 »

  1.   

    把你的函数改成过程.来处理.create or replace  procedure  f_sb_jbyxsj_lr( v_rq in varchar2, v_frontrq  in varchar2,v_sycj in varchar2,v_out out varchar2 ) 
        return number is
        result   number;
        v_count  number;
    begin
       select count(1)
         into v_count
         from sb_jbyxsj_lr
        where sycj = v_sycj and rq = to_date(v_frontrq,'yyyy-mm-dd');
       
       if v_count > 0 then
          --  有前一天的数据,修改累计时间、本次累计时间
          update sb_jbyxsj_lr a
             set a.ljsj = a.yxsj + 
                          ( select b.ljsj from sb_jbyxsj_lr b
             where a.sbbh = b.sbbh and b.sycj = v_sycj and 
                   b.rq = to_date(v_frontrq,'yyyy-mm-dd') ), 
         a.bclj = a.yxsj + 
                          ( select b.bclj from sb_jbyxsj_lr b
             where a.sbbh = b.sbbh and b.sycj = v_sycj and 
                   b.rq = to_date(v_frontrq,'yyyy-mm-dd') )
           where a.sycj = v_sycj and a.rq = to_date(v_rq,'yyyy-mm-dd') and 
                 a.sbbh in ( select c.sbbh from sb_jbyxsj_lr c
                      where a.sbbh = c.sbbh and c.sycj = v_sycj and 
                    c.rq = to_date(v_frontrq,'yyyy-mm-dd') );
       elsif
         -- 没有前一天的数据
         update sb_jbyxsj_lr
            set ljsj = ljsj + yxsj,
        bclj = bclj + yxsj
          where sycj = v_sycj and rq = to_date(v_rq,'yyyy-mm-dd');
       end if;   commit;
    --这里是增加部分   p_out:='执行成功!';
       exception
           when others then 
              rollback;
              p_out:='执行失败!';
    end;
      

  2.   

    sorry,如果还想同时返回一个number,就再加一个(v_number out number);
      

  3.   

    错误是由:
    update sb_jbyxsj_lr a
             set a.ljsj = a.yxsj + 
                          ( select b.ljsj from sb_jbyxsj_lr b
             where a.sbbh = b.sbbh and b.sycj = v_sycj and 
                   b.rq = to_date(v_frontrq,'yyyy-mm-dd') ), 
         a.bclj = a.yxsj + 
                          ( select b.bclj from sb_jbyxsj_lr b
             where a.sbbh = b.sbbh and b.sycj = v_sycj and 
                   b.rq = to_date(v_frontrq,'yyyy-mm-dd') )
           where a.sycj = v_sycj and a.rq = to_date(v_rq,'yyyy-mm-dd') and 
                 a.sbbh in ( select c.sbbh from sb_jbyxsj_lr c
                      where a.sbbh = c.sbbh and c.sycj = v_sycj and 
                    c.rq = to_date(v_frontrq,'yyyy-mm-dd') );
    这个语句因起的。