空记录的条件

如果我的字段为空,那么我需要条件

select * from data where :P2_EMPLOYEE is null then MANAGER = 'Alex'
lyp6197 回答:空记录的条件

我认为您需要coalesce()

select * 
from data 
where MANAGER = coalesce(:P2_EMPLOYEE,'Alex')
,

其他一些选项(除了您已经看到的选项之外):

where manager = case when :P2_EMPLOYEE is null then 'Alex'
                     else :P2_EMPLOYEE
                end;

where manager = decode(:P2_EMPLOYEE,null,'Alex',:P2_EMPLOYEE)

where manager = nvl(:P2_EMPLOYEE,'Alex')
本文链接:https://www.f2er.com/2817760.html

大家都在问