表中无记录时,nvl根本没起作业,因为没有参数传进去。

解决方案 »

  1.   

    strSql = ""
        strSql = strSql & "select nvl(PD_GP_OPE_CANDIDATE.N_COUNTER,0) N_COUNTER"
        strSql = strSql & "  from PD_GP_OPE_CANDIDATE"
        strSql = strSql & " where N_ORDER_CP=:p_order_cp"
        strSql = strSql & "   and N_ORDER_YEAR=:p_order_year"
        strSql = strSql & "   and N_ORDER_SEQ=:p_order_seq"
        strSql = strSql & "   and N_ORDER_PP_REQ_SEQ=:p_order_pp_req_seq"
        strSql = strSql & "   and N_ORDER_PP_FAB_SEQ=:p_order_pp_fab_seq"
        strSql = strSql & "   and K_GP_FORM=:p_form"
    ---------------------------------------------------
    就这么简单的一条sql会出现这种问题,郁闷ing,害的我在vb中还的用isnull判断,虽然问题解决了,但出于的编程技术的爱好,还是希望有人能给个正确答案
      

  2.   

    select nvl(nvl(PD_GP_INDICATION.N_COUNTER,0),0) N_COUNTER from .....
    再判断一次,不知道行不行
    祝好运,快给分
      

  3.   

    难道就没人能解决了?
    还是这是plsql的一个bug?
      

  4.   

    用decode吧,
    nvl()对字符型数据,
    看样子你这个是一个数制性的
      

  5.   

    select nvl(replace(PD_GP_INDICATION.N_COUNTER,'NULL',''),0) N_COUNTER from .....
      

  6.   

    这个问题我也存在,从外部传的sql语句在执行上与用sqlplus里直接执行有点不同。
    如果在sqlplus下执行上述代码应该没问题。
    我也是在程序中判断解决的。
    值为null时不可以把它们处理成空格之类,否则显示结果为null。
    不过你可以试试nvl(col,'0');
      

  7.   

    select count(*) into i 
    from PD_GP_OPE_CANDIDATE
    where .....if i>0 then 
    select nvl(replace(PD_GP_INDICATION.N_COUNTER,'NULL',''),0) N_COUNTER 
    from .......
    where .....