Anda dapat menulis where
klausa sebagai:
where (case when (:stateCode = '') then (1)
when (:stateCode != '') and (vw.state_cd in (:stateCode)) then 1
else 0)
end) = 1;
Atau, hapus case
seluruhnya:
where (:stateCode = '') or
((:stateCode != '') and vw.state_cd in (:stateCode));
Atau, bahkan lebih baik:
where (:stateCode = '') or vw.state_cd in (:stateCode)