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

lfree發表於2015-08-31

[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,可以發現會報錯。

SCOTT@test> @ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- ----------------------------------------------------------------
x86_64/Linux 2.4.xx            10.2.0.4.0     Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi

SCOTT@test> select deptno,dname,loc from dept where deptno = 10;
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
                                               *
ERROR at line 1:
ORA-00911: invalid character


SCOTT@test> select deptno,dname,loc from dept where deptno = 10;
      DEPTNO DNAME          LOC
------------ -------------- -------------
          10 ACCOUNTING     NEW YORK

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-1787122/,如需轉載,請註明出處,否則將追究法律責任。

相關文章