oracle - Using a parameter to filter out multiple values in sql -


in query (note i'm not using procedure) need use boolean parameter define whether filter out records or not.

my parameter's name "wo" (= without). - if user chooses &wo = 'true' want records filtered out.

my approach use 'case when' in clause following:

select * tbl1 case when &wo = 'true' tbl1.field1 not in ('ab','cd','ef') end 

i know syntax or whole approach incorrect.

you can't use case that; result of case needs compared something. this:

select * tbl1 nvl('&wo', 'false') != 'true' or tbl1.field1 not in ('ab','cd','ef') 

if first part of or equates false - is, &wo null or not true - second part not evaluated.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -