Case in Select 语句 returns 出错

Case in Select statement returns an error

SELECT 
    CONCAT('C','~') AS "1", FFIITMN,
    CASE WHEN FFIITMN IN (SELECT FGDITMN FROM S2151BDW.PWRDTA.FGDPRPIP WHERE FGDCMPN = '  1' THEN '1' ELSE '0' END) AS "16"
FROM 
    S2151BDW.PWRDTA.FFIITMAP --Item master file
    JOIN S2151BDW.PWRDTA.FFJITMBP ON FFJITMN = FFIITMN AND FFJCMPN = FFICMPN --Item balance file
    JOIN S2151BDW.PWRDTA.FFBCLSAP ON FFBCLSN = FFJCLSN AND FFBCMPN = FFICMPN --Item class file

WHERE 
    FFICMPN = '  1' 
AND
    FFIITMN = '    365725'

Returns错误:

Comparison operator IN not valid.. SQLCODE=-115, SQLSTATE=42601, DRIVER=3.69.56

是否可以在 select 中使用 case 语句来检查项目编号是否在另一个 table 中?

您的括号不匹配 - 右括号应该位于内部 SELECT 查询的末尾,而不是 CASE 块的末尾:

CASE WHEN FFIITMN IN (SELECT FGDITMN FROM S2151BDW.PWRDTA.FGDPRPIP WHERE FGDCMPN = '  1') THEN '1' ELSE '0' END AS "16"