Bạn có thể viết where
mệnh đề như:
where (case when (:stateCode = '') then (1)
when (:stateCode != '') and (vw.state_cd in (:stateCode)) then 1
else 0)
end) = 1;
Ngoài ra, hãy xóa case
hoàn toàn:
where (:stateCode = '') or
((:stateCode != '') and vw.state_cd in (:stateCode));
Hoặc, thậm chí tốt hơn:
where (:stateCode = '') or vw.state_cd in (:stateCode)