SQL> select 1 from dual where dump('aa ')=dump('aa');
1
----------
SQL> select 1 from dual where 'aa '='aa';
1
----------
1
SQL> select dump('aa ') from dual;
DUMP('AA')
----------------------
Typ=96 Len=3: 97,97,32
SQL> select dump('aa') from dual;
DUMP('AA')
-------------------
Typ=96 Len=2: 97,97
SQL> set serveroutput on
SQL>
SQL> declare
2 v1 varchar2(3):='aa ';
3 v2 varchar2(3):='aa';
4 begin
5 if v1=v2 then
6 dbms_output.put_line('ok');
7 else
8 dbms_output.put_line('not ok');
9 end if;
10 end;
11 /
not ok
PL/SQL procedure successfully completed
SQL>
SQL> declare
2 v1 char(3):='aa ';
3 v2 char(3):='aa';
4 begin
5 if v1=v2 then
6 dbms_output.put_line('ok');
7 else
8 dbms_output.put_line('not ok');
9 end if;
10 end;
11 /
ok
PL/SQL procedure successfully completed
SQL>
1
----------
SQL> select 1 from dual where 'aa '='aa';
1
----------
1
SQL> select dump('aa ') from dual;
DUMP('AA')
----------------------
Typ=96 Len=3: 97,97,32
SQL> select dump('aa') from dual;
DUMP('AA')
-------------------
Typ=96 Len=2: 97,97
SQL> set serveroutput on
SQL>
SQL> declare
2 v1 varchar2(3):='aa ';
3 v2 varchar2(3):='aa';
4 begin
5 if v1=v2 then
6 dbms_output.put_line('ok');
7 else
8 dbms_output.put_line('not ok');
9 end if;
10 end;
11 /
not ok
PL/SQL procedure successfully completed
SQL>
SQL> declare
2 v1 char(3):='aa ';
3 v2 char(3):='aa';
4 begin
5 if v1=v2 then
6 dbms_output.put_line('ok');
7 else
8 dbms_output.put_line('not ok');
9 end if;
10 end;
11 /
ok
PL/SQL procedure successfully completed
SQL>
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10742223/viewspace-344558/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10742223/viewspace-344558/