field1 = decode(:my_param,0,NULL,NOT NULL)

Hi,
 on Oracle 10
How can I write the above SQL query correctly?

If my parameter = 0 then
   return all the NULL values
Else
  return all the NOT NULL

Thanks
LVL 1
peledcAsked:
Who is Participating?
 
sdstuberCommented:
WHERE  (( :my_param = 0 and field1 is null)
or (:my_param != 0 and field1 is not null))
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.