小八路小八路(提问者)SELECT DISTINCT SHOW_LOT_ID, PRODUCT_ID, LOT_TYPE, PRIORITY, LOT_STATUS, RECIPE_ID, EQPT_ID, QTY, RUNCARD_ID, OPERATION_ID, CHECK_RCP, B.AREA, A.EQPGROUP,A.STEP_NO FROM
(SELECT B.SHOW_LOT_ID,A.PRODUCT_ID,A.LOT_TYPE,A.HOT_FLAG||\'-\'||A.LOT_PRIORITY PRIORITY,A.LOT_STATUS,B.RECIPE_ID,B.EQPT_ID,TO_NUMBER(A.LOT_QTY1) QTY,RUNCARD_ID, B.OPERATION_ID, B.CHECK_RCP, B.WORK_AREA,B.EQPGROUP,B.STEP_NO FROM P1ODSDA1.LOT_MASTER A,
(SELECT RUNCARD_ID,S.MAIN_LOT_ID,S.SHOW_LOT_ID,S.LOT_RRN,S.LOT_ID,S.STATUS,L.EQPT_ID,L.RECIPE_ID,L.CHECK_RCP,S.OPERATION_ID,
L.WORK_AREA ,L.EQPT_GROUP_ID EQPGROUP, L.STEP_NO FROM P1RPTDA1.SRC_LOT_STORE S,P1RPTDA1.SRC_LOT_SPECIAL_STEP L
WHERE S.RUNCARD_RRN <> 0 AND S.LOT_RRN =L.LOT_RRN AND S.RUNCARD_RRN = L.RUNCARD_RRN AND S.STEP_SEQUENCE = L.STEP_SEQUENCE)B
WHERE B.LOT_RRN = A.LOT_RRN(+) AND A.LOT_STATUS <> \'TERMINATED\') A,
(SELECT DISTINCT SELFGROUP, A.EQPGROUP, AREA, EQPID FROM SXRPTUSER.MFG_TB_SELFGROUP_EQPGROUP A,SXRPTUSER.MFG_TBL_KEYEQP_GROUP_N B
WHERE A.SELFGROUP = B.EQPGROUP) B
WHERE (A.EQPT_ID = B.EQPID OR A.EQPGROUP = B.EQPGROUP)
${if(len(SHOW_LOT_ID) == 0,\"\",\"and SHOW_LOT_ID in (\'\" + SHOW_LOT_ID + \"\')\")}
${if(len(area) == 0,\"\",\"and area = (\'\" + area + \"\')\")}