SQL regular expression to match null values

I want to query a table based on the value of a variable. If the variable is null, then I want to return all the rows.I tried using the following query:-
select * from abc_tbl where fld1 like nvl(fld1,’%’). In this table, there are certain rows that have null values.Those rows are not returned when I used the above query. I tried using regular expressions also- select * from abc_tbl where regexp_like (fld1,'(.)*’). But none of this is meeting the requirement. Kindly suggest a solution

Source: regex

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.