My question is very similar to SQL Switch/Case in where clause.
I get parameters. If it is excpected that value is NULL, I need to get all the values, otherwise I need to filter with value.
I'm trying to do this in SQL:
WHERE param
CASE
WHEN #{value} IS NULL THEN {IS NOT NULL}
ELSE =#{value}
END
How should I correct this SQL request?
WHERE param IS NOT NULL // all values if **value** is NULL
WHERE param = #{value} // i.e. value = 'data'