我在 where 子句中的最后一个 CASE 语句上遇到编译器错误。我似乎无法弄清楚我做错了什么......任何帮助将不胜感激,谢谢。
P1: BEGIN
DECLARE cursor1 CURSOR WITH RETURN FOR
SELECT DISTINCT MPWBIPS.MIP_NO,
MPWBIPS.ITEM_NO,
MPWBIPS.MATL_PLNR_ID,
MPWBIPS.ITEM_OBS_STATUS,
MPWBMIT.EXCS_ITEM_COST_TOT,
MPWBMIP.TRGT_CHGOVR_DATE,
SLOTLOC.LOT_FROM_EFF_DATE,
FROM MPWBIPS MPWBIPS
INNER JOIN MPWBMIT MPWBMIT
ON MPWBMIT.MIP_NO = MPWBIPS.MIP_NO
AND MPWBMIT.ITEM_NO = MPWBIPS.ITEM_NO
INNER JOIN MPPLNR MPPLNR
ON MPWBIPS.MATL_PLNR_ID = MPPLNR.MATL_PLNR_ID
INNER JOIN MPWBMIP MPWBMIP
ON MPWBIPS.MIP_NO = MPWBMIP.MIP_NO
INNER JOIN SMPROJ_DPIMS SMPROJ
ON MPWBIPS.MIP_NO = SMPROJ.MIP_NO
INNER JOIN SLOTLOC_DPIMS SLOTLOC
ON SMPROJ.MFG_CHGOVR_PER = SLOTLOC.LOT
WHERE plannerID =
CASE WHEN mgrIndc = 'Y' THEN
MPPLNR.MGR_LID
WHEN suprvIndc = 'Y' THEN
MPPLNR.SPRVSR_LID
WHEN plannerID = '' THEN
''
ELSE
MPPLNR.MATL_PLNR_ID
END
AND CASE WHEN obsStatus = 'ACTION' THEN
MPWBIPS.ITEM_OBS_STATUS <> 'RESOLVED 99'
AND MPWBIPS.ITEM_OBS_STATUS <> 'EXCESS 90'
WHEN obsStatus = 'ALL' OR obsStatus = '' THEN
obsStatus = ''
ELSE
MPWBIPS.ITEM_OBS_STATUS = obsStatus
END
AND (COALESCE(mipNo, '') = '' OR MPWBIPS.MIP_NO = mipNo);
OPEN cursor1;
结束 P1