select * from operator where ( pwd is null and ' ' =' ' or pwd='') and oper='9004'
select * from operator where ( pwd is null or pwd='') and oper='9004'
请问这两条语句在oracle中为什么会得到不同的结果?
在sqlserver里是一样的
oracle中不允许''=''这种条件形式?因为我把它改成 '1'='1'就正常了
但
begin
if('' <> '') then
dbms_output.put_line('不等');
else
dbms_output.put_line('相等');
end if;
end;
我用这个在oracle中执行又输出是相等的,请各位指点迷津...
------解决思路----------------------
‘’在oracle里面为null。null比较即不相等也不不相等。不能比较
------解决思路----------------------
在 select 语句中, '' 和 NULL ,视同一个东西,且只能使用 is null 这种形式来比较
比如,你有写了如下语句,也是查不出任何数据来的
select * from mytable where ''= ''