where
を書くことができます 節:
where (case when (:stateCode = '') then (1)
when (:stateCode != '') and (vw.state_cd in (:stateCode)) then 1
else 0)
end) = 1;
または、case
を削除します 完全に:
where (:stateCode = '') or
((:stateCode != '') and vw.state_cd in (:stateCode));
または、さらに良い:
where (:stateCode = '') or vw.state_cd in (:stateCode)