Du kan skriva
where (case when (:stateCode = '') then (1)
when (:stateCode != '') and (vw.state_cd in (:stateCode)) then 1
else 0)
end) = 1;
Alternativt kan du ta bort case
helt och hållet:
where (:stateCode = '') or
((:stateCode != '') and vw.state_cd in (:stateCode));
Eller ännu bättre:
where (:stateCode = '') or vw.state_cd in (:stateCode)