2011年12月13日 星期二

{Oracle} ORA CODE(持續更新;更新時間:10/01)

1.ORA-00913: too many values
前題:在INSERT INTO ABC@ccc.world SELECT * FROM ABC WHERE id = :Id
             的語法下,產生ORA-00913
解惑:ABC@ccc.world Table欄位數與ABC Table欄位數不符而致


2.ORA-01795:
前題:SELECT * FROM ABC WHERE column in('1','2',.........................................)
解惑:因in語法中超過1000筆資料造成錯誤,其將語法改為 SELECT * FROM ABC WHERE
column in('1'......) or column in('1001',...............)

3.ORA-00904:invalid identifier

前題:SELECT * FROM ABC WHERE column='y'
解惑:語法中column名稱打錯,不在ABC Table中

4.ORA-01722:invalid number

前題:SELECT To_char(abc,'yyyy') FROM ABC
解惑:轉型失敗,查abc欄位內值是否有無法轉型的格式

5.ORA-00979: not a GROUP BY expression
前題:SELECT column2 FROM ABC GROUP BY column1
解惑: column1不在select list中,無法Group

6.ORA-01843:not a valid month
前題:SELECT TO_CHAR(columnDate,'yyyy-MM-dd')   FROM ABC WHERE columnDate between '2012-1月-01' AND '2013-1月-01'
解惑: columnDate日期格式如有中文,勿直接Where中文格式;改寫為
SELECT TO_CHAR(columnDate,'yyyy-MM-dd')   FROM ABC WHERE TO_CHAR(columnDate,'yyyy-MM-dd') between '2012-01-01' AND '2013-01-01';