THEN
klausa dalam CASE
ekspresi salah:
CASE WHEN SUM(L55.TOTAL_QUANTITY - BC.FULLBOX * L55.PACKING_STYLE) = 0
THEN L55.SPAREBOX = 0
----------^
WHEN SUM(L55.TOTAL_QUANTITY - BC.FULLBOX * L55.PACKING_STYLE) != 0
THEN L55.SPAREBOX = 1
END AS SPARE_QUANTITY
Oracle tidak memiliki tipe data Boolean di SELECT
kueri.
Saya kira Anda hanya ingin:
(CASE WHEN SUM(L55.TOTAL_QUANTITY - BC.FULLBOX * L55.PACKING_STYLE) = 0
THEN 0
WHEN SUM(L55.TOTAL_QUANTITY - BC.FULLBOX * L55.PACKING_STYLE) <> 0
THEN 1
END) AS SPARE_QUANTITY
Atau, jika Anda ingin menghilangkan CASE
:
ABS(SIGN(SUM(L55.TOTAL_QUANTITY - BC.FULLBOX * L55.PACKING_STYLE))) AS SPARE_QUANTITY