Sql where空记录的条件
如果我的字段为空,那么我需要条件Sql where空记录的条件,sql,oracle-apex,oracle-apex-5,oracle-apex-5.1,Sql,Oracle Apex,Oracle Apex 5,Oracle Apex 5.1,如果我的字段为空,那么我需要条件 select * from data where :P2_EMPLOYEE is null then MANAGER = 'Alex' 我认为你需要: 其他几个选项(除了您已经看到的选项外): 。。。其中(:P2_EMPLOYEE为null,MANAGER='Alex')或(:P2_EMPLOYEE不为null)) select * from data where MANAGER = coalesce(:P2_EMPLOYEE, 'Alex') wher
select * from data where :P2_EMPLOYEE is null then MANAGER = 'Alex'
我认为你需要:
其他几个选项(除了您已经看到的选项外):
。。。其中(:P2_EMPLOYEE为null,MANAGER='Alex')或(:P2_EMPLOYEE不为null))
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')