用SQL建模板数据集预览数据时报错

本帖最后由 xynss 于 2017-5-2 16:55 编辑

我用以下SQL建报表的模板数据集:
select distinct a.userid,
                a.username,
                a.useraddr,
                a.busitype,
                c.busitypename,
                to_char(a.createtime, 'yyyy-MM-dd') busiacceptime,
                to_char(a.endtime, 'yyyy-MM-dd') endtime,
                to_char(a.starttime, 'yyyy-MM-dd') starttime,
                a.mtdeptcode,
                a.mtoptcode,
                d.optname createuser,
                e.orgname,
                f.optname,
                b.*,
                to_char(nvl(fee.prefeprice, 0)) prefeprice
  from t_mms2_workorder a
right join (select workorderpkid,
                    mtcode,
                    max(mtname) mtname,
                    to_char(max(price)) price,
                    max(unit) unit,
                    to_char(sum(count)) count,
                    to_char(sum(amount)) amount,
                    max(createby) createby
               from t_mms2_material
              group by mtcode, workorderpkid) b
    on a.pkid = b.workorderpkid
  left join t_mms2_busitype c
    on a.BUSITYPE = c.busitype
  left join t_ms_operator d
    on b.createby = d.account
  left join t_ms_organization e
    on a.mtdeptcode = e.orgcode
  left join t_ms_operator f
    on f.account = a.mtoptcode
  left join (select fee.workorderpkid,
                    max(fee.prefeprice) prefeprice,
                    max(fee.totalprice) totalprice
               from t_mms2_mtfee fee
              where fee.feetype = 'GS005'
              group by fee.workorderpkid) fee
    on fee.workorderpkid = a.pkid;

预览数据时报这个错:(SQL在PL/SQL中是可以执行的)


请帮忙解决,谢谢!
FineReportxynss 发布于 2017-5-2 16:50
悬赏:2 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共6回答
最佳回答
0
dgmd521发布于2017-5-2 16:50(编辑于 2023-9-6 09:34)
555
  • xynss xynss(提问者)

    非常谢谢!就是多了一个分号的原因。
    回复
    2017-05-03 09:31 
最佳回答
0
zsh331发布于2017-5-2 16:54(编辑于 2023-9-6 09:34)
555
  • xynss xynss(提问者)

    select distinct a.userid,
                    a.username,
                    a.useraddr,
                    a.busitype,
                    c.busitypename,
                    to_char(a.createtime, \'yyyy-MM-dd\') busiacceptime,
                    to_char(a.endtime, \'yyyy-MM-dd\') endtime,
                    to_char(a.starttime, \'yyyy-MM-dd\') starttime,
                    a.mtdeptcode,
                    a.mtoptcode,
                    d.optname createuser,
                    e.orgname,
                    f.optname,
                    b.*,
                    to_char(nvl(fee.prefeprice, 0)) prefeprice
      from t_mms2_workorder a
    right join (select workorderpkid,
                        mtcode,
                        max(mtname) mtname,
                        to_char(max(price)) price,
                        max(unit) unit,
                        to_char(sum(count)) count,
                        to_char(sum(amount)) amount,
                        max(createby) createby
                   from t_mms2_material
                  group by mtcode, workorderpkid) b
        on a.pkid = b.workorderpkid
      left join t_mms2_busitype c
        on a.BUSITYPE = c.busitype
      left join t_ms_operator d
        on b.createby = d.account
      left join t_ms_organization e
        on a.mtdeptcode = e.orgcode
      left join t_ms_operator f
        on f.account = a.mtoptcode
      left join (select fee.workorderpkid,
                        max(fee.prefeprice) prefeprice,
                        max(fee.totalprice) totalprice
                   from t_mms2_mtfee fee
                  where fee.feetype = \'GS005\'
                  group by fee.workorderpkid) fy
        on fy.workorderpkid = a.pkid;

    分开后,还是报同样的错
    回复
    2017-05-02 16:59 
最佳回答
0
xynss发布于2017-5-2 16:59(编辑于 2023-9-6 09:34)
555
  • zsh331 zsh331

    空指针异常,应该不是sql的问题,你检查下参数或JS之类的。{:9_225:}
    回复
    2017-05-02 22:48 
最佳回答
0
zsh331发布于2017-5-2 22:48(编辑于 2023-9-6 09:34)
555
最佳回答
0
xynss发布于2017-5-3 09:15(编辑于 2023-9-6 09:34)
555
最佳回答
0
xynss发布于2017-5-3 09:31(编辑于 2023-9-6 09:34)
555
  • 0关注人数
  • 532浏览人数
  • 最后回答于:2017-5-3 09:31
    活动推荐 更多
    热门课程 更多
    返回顶部