估计是数字+NULL+NULL造成,处理一下就行了吧~

解决方案 »

  1.   

    SQL> SELECT 0+NULL+NULL FROM DUAL;0+NULL+NULL
    -----------SQL> SELECT 0+NVL(NULL,0) FROM DUAL;0+NVL(NULL,0)
    -------------
                0
      

  2.   

    select (
    nvl((select sum(b.auditnumber) from bt_t_monthbudget a,bt_t_monthbudget b 
    where a.year='2005' and b.year='2005'and b.month='03'
    and b.departmentid='02' and a.costid='09'
    and a.month='03'and a.departmentid='02'and a.costid=substr(b.costid,0,length(a.costid))
     group by a.costid),0)+
    nvl((select sum(b.auditnumber) from bt_t_monthbudget a,bt_t_monthbudget b 
    where a.year='2005' and b.year='2005'and b.month='02'
    and b.departmentid='02' and a.costid='09'
    and a.month='02'and a.departmentid='02'and a.costid=substr(b.costid,0,length(a.costid))
     group by a.costid),0)+
    nvl((select sum(b.auditnumber) from bt_t_monthbudget a,bt_t_monthbudget b 
    where a.year='2005' and b.year='2005'and b.month='01'
    and b.departmentid='02' and a.costid='09'
    and a.month='01'and a.departmentid='02'and a.costid=substr(b.costid,0,length(a.costid))
     group by a.costid),0))as month 
    from bt_t_monthbudget where year='2005'and departmentid='02'
     
     and month='01'
     and costid='09'
      

  3.   

    select (
    nvl((select sum(b.auditnumber) from bt_t_monthbudget a,bt_t_monthbudget b 
    where a.year='2005' and b.year='2005'and b.month='03'
    and b.departmentid='02' and a.costid='09'
    and a.month='03'and a.departmentid='02'and a.costid=substr(b.costid,0,length(a.costid))
     group by a.costid),0)+
    nvl((select sum(b.auditnumber) from bt_t_monthbudget a,bt_t_monthbudget b 
    where a.year='2005' and b.year='2005'and b.month='02'
    and b.departmentid='02' and a.costid='09'
    and a.month='02'and a.departmentid='02'and a.costid=substr(b.costid,0,length(a.costid))
     group by a.costid),0)+
    nvl((select sum(b.auditnumber) from bt_t_monthbudget a,bt_t_monthbudget b 
    where a.year='2005' and b.year='2005'and b.month='01'
    and b.departmentid='02' and a.costid='09'
    and a.month='01'and a.departmentid='02'and a.costid=substr(b.costid,0,length(a.costid))
     group by a.costid),0))as month 
    from bt_t_monthbudget where year='2005'and departmentid='02'
     
     and month='01'
     and costid='09'