Wpis z mikrobloga

select r.* from my_table r
where
(
(@nip_on_doc = 'YES' AND r.nip <> '') OR
(@nip_on_doc = 'NO' AND r.nip = '') OR
(@nip_on_doc = 'UNDEFINED')
)
AND ...

?