Predikat CASE
ekspresi (yaitu apa yang muncul setelah THEN
) harus berupa nilai, bukan logika. Anda dapat menyusun ulang WHERE
klausa sebagai berikut:
WHERE
p.resource_qry_seq = b.resource_qry_seq AND
p.resource_id = b.resource_id AND
((b.flexible_time IS NULL AND
(b.activity_start >= p.activity_start AND b.activity_end < p.activity_end) OR
(b.activity_start > p.activity_start AND b.activity_end <= p.activity_end)) OR
(b.flexible_time IS NOT NULL AND b.activity_start > p.late_start))