Annie
Annie

Reputation: 131

SQL regular expression to match blank 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 blank 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

Upvotes: 0

Views: 639

Answers (1)

Mukesh Kalgude
Mukesh Kalgude

Reputation: 4844

try this query

select * from abc_tbl where fld1 is null

Upvotes: 3

Related Questions