天天看點

[20150831]中文符号在sql語句.txt

[20150831]中文符号在sql語句.txt

--今天在檢查代碼時發現sql語句中存在全角的等号"=",很明顯oracle并沒有報錯。

--實際上itpub上以前有人提到全角","也不會報錯。

--自己也測試一下:

SCOTT@test> @ver1

PORT_STRING                    VERSION        BANNER

------------------------------ -------------- --------------------------------------------------------------------------------

x86_64/Linux 2.4.xx            11.2.0.3.0     Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

SCOTT@test> select deptno,dname,loc from dept where deptno = 10;

    DEPTNO DNAME          LOC

---------- -------------- -------------

        10 ACCOUNTING     NEW YORK

--可以發現執行正常。如果在10g,可以發現會報錯。

------------------------------ -------------- ----------------------------------------------------------------

x86_64/Linux 2.4.xx            10.2.0.4.0     Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi

select deptno,dname,loc from dept where deptno = 10

             *

ERROR at line 1:

ORA-00911: invalid character

SCOTT@test> select deptno,dname,loc from dept where deptno = 10;

select deptno,dname,loc from dept where deptno = 10

                                               *

SCOTT@test> select deptno,dname,loc from dept where deptno = 10;

      DEPTNO DNAME          LOC

------------ -------------- -------------

          10 ACCOUNTING     NEW YORK