Skip to content
Advertisement

Oracle Like Operator in Where condition and decode

I’m trying to write a PL-SQL query to return records from multiple table and using decode to allow null value comparison,

The result is returning only where DeptName is exactly matching to the database values, but I want a query to return something e.Department like '%DeptName%'

Advertisement

Answer

No need for anything other than boolean logic:

If you want a NULL parameter to only match NULL values, then use:

I would also recommend that you give your parameters names that are more obviously parameters. I often prefix with in_ or out_:

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