遇到的Oracle錯誤訊息筆記
2014年10月2日 星期四
錯誤訊息為:
--------------------------------------------------------------------------------------------------------------------------
ORA-00911:invalid character (字元無效)
--------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------
00911. 00000 - "invalid character"
*Cause: identifiers may not start with any ASCII character other than
letters and numbers. $#_ are also allowed after the first
character. Identifiers enclosed by doublequotes may contain
any character other than a doublequote. Alternative quotes
(q'#...#') cannot use spaces, tabs, or carriage returns as
delimiters. For all other contexts, consult the SQL Language
Reference Manual.
查到的原因為我在串SQL字串裡,有加逗號,只要把逗號去掉即合;
例:
錯誤
varSQL := 'select * from log ;';
正確
varSQL :='select * from log';
PLS-00306: wrong number or types of arguments
--------------------------------------------------------------------------------------------------------------------------
最近在Call Procedure,有發生以下的問題,請注意程式給的Parameters參數是否跟Procedure裡面定義的一樣,有時候不小心沒注意到就會發生錯誤,這要注意一下。
錯誤訊息:
System.Exception: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'ICS_USER_PAUSE' ORA-06550: line 1, column 7: PL/SQL: Statement ignored
例: SQL
procedure GET_ORDERLIST ( P_ORDERLISTID in PKG_TEST.STRING_ARRAY, P_RETURNCURSOR OUT SYS_REFCURSOR );程式
var oracleCommand = new OracleCommand(); oracleCommand.Connection = (OracleConnection)command.Connection; oracleCommand.CommandType = CommandType.StoredProcedure; oracleCommand.CommandText = "PKG_TEST.GET_ORDERLIST"; var arryIds = new OracleParameter { ParameterName = "@P_ORDERLISTID", OracleDbType = OracleDbType.Varchar2, CollectionType = OracleCollectionType.PLSQLAssociativeArray, Value = theSearchList.ToArray(), Size = theSearchList.Count(), Direction = ParameterDirection.Input }; //Parameters一定要跟Procedure一樣才不會出錯喔 oracleCommand.Parameters.Add(arryIds); oracleCommand.Parameters.Add("@P_RETURNCURSOR", OracleDbType.RefCursor, ParameterDirection.Output); oracleCommand.ExecuteNonQuery();--------------------------------------------------------------------------------------------------------------------------
0 意見:
張貼留言