user3193026
user3193026

Reputation: 39

Oracle NVL wild card search

I have a search page where for null values I use NVL for null conditions. But for one field I have to do a wildcard search. Is nvl possible with wildcard search eg. NVL(null,%name%)?

Upvotes: 1

Views: 605

Answers (2)

Eyiwunmi Dawodu
Eyiwunmi Dawodu

Reputation: 1

select * from your_table where column_name like NVL('%name%',column_name)

Upvotes: 0

Atiris
Atiris

Reputation: 2703

You can use NVL in this case only as "subfunction"
If you want get also null-s results do it like this:

SELECT anything 
  FROM your_table 
 WHERE NVL(column_can_be_null, 'substring_you_search_for')
       LIKE '%substring_you_search_for%'

Upvotes: 2

Related Questions