简体   繁体   中英

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

试试这个查询

select * from abc_tbl where fld1 is null

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM