Skip to content
Advertisement

CASE expression in WHERE clause for diferent and

Can I use case expression to build where like this?

I need change where clause depending on the value of x variable.

Advertisement

Answer

An alternative to using OR is to use nested CASE statements:

or you could simplify it to:

However, you should check whether Oracle can use column indexes or if a separate function-based index is required with these solutions.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement