Sql 在case-when语句中,如何在where子句中输出'is-null'?

Sql 在case-when语句中,如何在where子句中输出'is-null'?,sql,oracle,Sql,Oracle,查询检查程序内下拉菜单传递的参数foo的值。如果该参数包含某个值,则属性应仅包含null值。没有pl/SQL我可以管理吗 select * from table t where case when $foo$ = 'yes' then t.something is null end 你是说这个逻辑吗 select something from table t where ($foo$ = 'yes' and t.something is null) or ($foo != 'yes') 只

查询检查程序内下拉菜单传递的参数foo的值。如果该参数包含某个值,则属性应仅包含null值。没有pl/SQL我可以管理吗

select * from table t
where case when $foo$ = 'yes' then t.something is null end

你是说这个逻辑吗

select something 
from table t
where ($foo$ = 'yes' and t.something is null) or ($foo != 'yes')
只需使用nvl功能:

select * 
  from mytable t
 where nvl($foo$,'yes') = 'yes';

是的,先生。谢谢你,愿耶稣保佑你。