sql列別名引發ORA-00923: FROM keyword not found where expected

wisdomone1發表於2013-02-28

SQL> create table t_a(a int);
 
Table created
 
SQL> select a as 成功/失敗 from t_a;--因別名包含/引發錯誤
 
select a as 成功/失敗 from t_a
 
ORA-00923: FROM keyword not found where expected
 
SQL> select a as '成功/失敗' from t_a;--對別名新增單引號失敗
 
select a as '成功/失敗' from t_a
 
ORA-00923: FROM keyword not found where expected
 
SQL> select a as "成功/失敗" from t_a;--新增雙引號即可
 
                                  成功/失敗
---------------------------------------
 

小結:1,最好在列別名不用要漢字,相容太差

         2,不要在列別名中使用特殊字元如:/

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

相關文章