${if(aaa=o,\\\"sql\\\",\\\"sql\\\")}sql里参数条件加上if(len)判断

${IF(isSubLot=\"yes\",\" select t2.lot_id,t1.ROUTE_ID,t1.OPERATION_ID,t2.IN_QTY,t2.OUT_QTY,t2.yield from (SELECT T.STEP_SEQ,ROUTE_ID,OM.OPERATION_ID FROM (SELECT P.ROUTE_ID,P.OPERATION_RRN, MIN(P.STEP_SEQ) STEP_SEQ FROM PROCESS_WORKFLOW_SUMM P, PROCESS_MASTER PM WHERE P.PROCESS_RRN = PM.PROCESS_RRN -- AND P.PROCESS_VERSION = PM.CURRENT_VERSION AND P.PROCESS_VERSION = \'\"+ver+\"\' AND EXISTS (SELECT 1 FROM PRODUCT_PROCESS_MASTER PPM, PRODUCT_MASTER PM WHERE P.PROCESS_RRN = PPM.PROCESS_RRN and PPM.PRODUCT_RRN = PM.PRODUCT_RRN AND pm.product_id = \'\"+productId+\"\' ) group BY P.ROUTE_ID,P.OPERATION_RRN) T, OPERATION_MASTER OM WHERE T.OPERATION_RRN = OM.OPERATION_RRN) t1, (SELECT t.lot_id, t.route_id, t.operation_id, sum(t.move_in_qty1) IN_QTY, sum(t.move_out_qty1) OUT_QTY, round(decode(nvl(sum(t.move_in_qty1), 0), 0, 0, nvl(sum(t.move_out_qty1), 0) / nvl(sum(t.move_in_qty1), 0)), 6) yield FROM (select T.LOT_ID, T.STEP_SEQUENCE, T.ROUTE_ID, T.OPERATION_ID, T.MOVE_IN_QTY1, T.MOVE_OUT_QTY1, RANK() OVER(PARTITION BY T.LOT_RRN,T.ROUTE_ID, T.OPERATION_RRN order by T.STEP_SEQUENCE DESC) R from lot_step_history t, LOT_MASTER LM, p2rptda1.workorder wo,P2RPTDA1.Item i where t.move_out_qty1 is not null and lm.product_rrn = i.item_rrn(+) AND lm.Outer_Order_No = \'\"+orderNo+\"\' AND WO.WORK_ORDER_TYPE = \'\"+orderType+\"\' AND i.Encapsulated_Type = \'\"+encapsulatedType+\"\' AND lm.product_id = \'\"+productId+\"\' AND lm.LOT_ID = \'\"+lotId+\"\' AND T.PROCESS_VERSION = \'\"+ver+\"\' AND T.LOT_RRN = LM.LOT_RRN and lm.outer_order_no = wo.workorder_id(+) ) T WHERE R = 1 group by t.lot_id, t.route_id, t.operation_id) t2 where t1.ROUTE_ID = t2.ROUTE_ID(+) and t1.OPERATION_ID= t2.OPERATION_ID(+) order by t1.STEP_SEQ\",\"select 2 from dual\")}













SQL里

AND lm.Outer_Order_No = \'\"+orderNo+\"\' AND WO.WORK_ORDER_TYPE = \'\"+orderType+\"\' AND i.Encapsulated_Type = \'\"+encapsulatedType+\"\' AND lm.product_id = \'\"+productId+\"\' AND lm.LOT_ID = \'\"+lotId+\"\' AND T.PROCESS_VERSION = \'\"+ver+\"\' 这几个加上if(len) 判断

FineReport 燚燚燚 发布于 2020-10-16 16:45 (编辑于 2020-10-16 16:46)
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共1回答
最佳回答
1
axingLv6专家互助
发布于2020-10-16 17:04

这样写看起来很乱,不容易维护,可以通过关联数据集来实现

分别创建ds1、ds2、ds3等等,每个里面写一个sql查询,再写条件公式判断执行哪个。

这样你条件里的判断为空执行全部就可以正常写了

222

  • 2关注人数
  • 482浏览人数
  • 最后回答于:2020-10-16 17:04
    请选择关闭问题的原因
    确定 取消
    返回顶部