On an Oracle 11g engine using PL/SQL
I have logic that runs like this
if (flag = Y) then
select id, flavor, color
from menu
where flavor in (1,2,3,4,5);
else
select
id, flavor, color
from
menu
where flavor in (2,4,6);
end if;
I’m thinking using decode or case logic in the where clause? I’d like to have just one query that can handle both ‘flag’ values.
Can you just change it to use an OR? (assumed that flag it N if not Y, but may be NULL which will be treated as N)
if you want to check for flag <> Y (in a similar fashion as @Crappy Coding Guy posted, but it can be NULL, changing
to
will suffice