Oracle 存储过程中 判断 某个字符是否为 ‘’ 或者 为 null

DECLARE
begin
IF '1234' <> '' THEN
  DBMS_OUTPUT.PUT_LINE('1');
ELSE
  DBMS_OUTPUT.PUT_LINE('2');
END IF;
end;


结果为 2,判断为false,显然这个是有问题的。


declare
begin
IF '' is null then
SYS.DBMS_OUTPUT.PUT_LINE('1');
else
SYS.DBMS_OUTPUT.PUT_LINE('2');
end if;
end;

结果为 1,说明‘’和 null 是相同的。


结果为 1,说明‘’和 null 是相同的。

猜你喜欢

转载自blog.csdn.net/qq_25775675/article/details/79740940