I try to use IF ELSE statement in a sql query because of legacy application that takes user input and run the same query. Depending on the user's input I need different results. Here is what I am trying to achieve:
SELECT * FROM TABLE_A a, TABLE_B b
where a.user_id = b.user_id
AND IF
b.last_name = '' or b.last_name = NULL
THEN
a.user_id in (1, 2, 3) or a.user_name in ('John', 'Mark', 'Lucas')
ELSE
b.last_name = 'DOE'
nullin Oracle.column = NULLis not bad practice, it is simply wrong. But that isn't what you wrote; you wrotecolumn = ''which (to me) suggests you weren't aware that''is the same asNULL(since you left it there, followed byOR column IS NULL).