Skip to content
Advertisement

Execute different WHERE statement based on IF conditions depending on @variable?

I have a nativeQuery in my DAO layer inside my Spring Boot app.

Basically, I’ passing three parameters, like so:

I would like to have different WHERE statements executing depending on value of companyName, something like this:

Or

Advertisement

Answer

Use boolean logic:

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