简体   繁体   English

SQL正则表达式匹配空白值

[英]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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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