Oracle PL/SQL string compare issue

2019-02-01 21:22发布

1).Hello, I have the following Oracle PL/SQL codes that may be rusty from you guys perspective:

 DECLARE
 str1  varchar2(4000);
 str2  varchar2(4000);
 BEGIN
   str1:='';
   str2:='sdd';
   IF(str1<>str2) THEN
    dbms_output.put_line('The two strings is not equal');
   END IF;
 END;
 /

This is very obvious that two strings str1 and str2 are not equal, but why 'The two strings are not equal' was not printed out? Do Oracle have another common method to compare two string?

7条回答
贼婆χ
2楼-- · 2019-02-01 21:53

Only change the line str1:=''; to str1:=' ';

查看更多
登录 后发表回答