我想将case
语句用于下面的列
SELECT sr_no, TYPE, stage, party_name, amount, remarks, exp_type, exp_id,
voucher_no, cheque_no, cheque_dt, chq_favr_name, attachment,
CASE NVL (amount, 0) = 0 THEN checkVal = 0
ELSE
checkVal = 1
FROM xxcus.xxacl_pn_expense_info
WHERE mkey = '354'
AND ((NVL (amount, 0) <> 0) OR (party_name IS NOT NULL))
ORDER BY sr_no
但我收到错误
ORA-00923:未找到FROM关键字
答案 0 :(得分:4)
SELECT sr_no, TYPE, stage, party_name, amount, remarks, exp_type, exp_id,
voucher_no, cheque_no, cheque_dt, chq_favr_name, attachment,
CASE WHEN NVL(amount, 0) = 0 THEN 0 ELSE 1 END AS checkVal
FROM xxcus.xxacl_pn_expense_info
WHERE mkey = '354'
AND ((NVL (amount, 0) <> 0) OR (party_name IS NOT NULL))
ORDER BY sr_no
答案 1 :(得分:0)
你错过了一个END
SELECT sr_no, TYPE, stage, party_name, amount, remarks, exp_type, exp_id,
voucher_no, cheque_no, cheque_dt, chq_favr_name, attachment,
CASE WHEN NVL (amount, 0) = 0 THEN checkVal = 0
ELSE
checkVal = 1
END
FROM xxcus.xxacl_pn_expense_info
WHERE mkey = '354'
AND ((NVL (amount, 0) <> 0) OR (party_name IS NOT NULL))
ORDER BY sr_no