错误" ORA-00936:缺少表达式"用于以下SQL语句

时间:2014-10-10 15:46:38

标签: sql oracle oracle11g

请帮助检查以下SQL语句在Oracle 11g R2上执行时出现“ORA-00936:缺少表达式”错误的原因。

    select part.*,
        decode(pv.dspuom, null, part.untqty, part.untqty / prtftp_dtl.untqty) dsp_untqty,
        decode(pv.dspuom, null, pv.stkuom, pv.dspuom) untqty_uom,
        decode(pv.dspuom, null, cast(null as int), pv.stkuom, cast(null as int), mod(part.untqty, prtftp_dtl.untqty)) rem_untqty,
        decode(pv.dspuom, null, null, pv.stkuom, null, pv.stkuom) rem_untqty_uom
   from (select @select_on:raw sum(untqty) untqty,
                sum(catch_qty) catch_qty,
                invadj.prtnum fixed_prtnum,
                invadj.prt_client_id fixed_prt_client_id,
                invadj.wh_id fixed_wh_id,
                invadj.play_prc_id
           from invadj
          where exists(select 'x'
                         from prtmst_view
                        where prtmst_view.prtnum = invadj.prtnum
                          and prtmst_view.prt_client_id = invadj.prt_client_id
                          and prtmst_view.wh_id = invadj.wh_id
                          and prtmst_view.prdflg = 1)
            and @+moddte:date
            and @+invadj.play_prc_id
            and @+invadj.prtnum
            and @+invadj.prt_client_id
            and wh_id = @wh_id
            and @*
          group by @result_string:raw,
                invadj.prtnum,
                invadj.prt_client_id,
                invadj.wh_id,
                invadj.play_prc_id
         having sum(untqty) <> 0
             or sum(catch_qty) <> 0) part left
   join prtmst_view pv
     on pv.prtnum = part.fixed_prtnum
    and pv.prt_client_id = part.fixed_prt_client_id
    and pv.wh_id = part.fixed_wh_id left
   join prtftp
     on prtftp.prtnum = pv.prtnum
    and prtftp.prt_client_id = pv.prt_client_id
    and prtftp.wh_id = pv.wh_id
    and prtftp.defftp_flg = 1 left
   join prtftp_dtl
     on prtftp.prtnum = prtftp_dtl.prtnum
    and prtftp.ftpcod = prtftp_dtl.ftpcod
    and prtftp.prt_client_id = prtftp_dtl.prt_client_id
    and prtftp.wh_id = prtftp_dtl.wh_id
    and prtftp_dtl.uomcod = nvl(pv.dspuom, pv.stkuom)    

1 个答案:

答案 0 :(得分:0)

我认为语法可能有些偏差。

请看下面的这一行

FROM (SELECT @ select_on:raw sum(untqty) untqty,

@字符似乎很奇怪