我正在嘗試調用具有返回類型數字的Oracle函數。我使用OleDB從C#調用,並且我明白Oracle中的類型編號映射是小數。每當我打電話給我時,我都會回到0。Oracle c#編號函數始終返回0
using (OleDbCommand _cmdDueAtDock = new OleDbCommand()) {
_cmdDueAtDock.Connection = connection;
_cmdDueAtDock.CommandType = CommandType.StoredProcedure;
_cmdDueAtDock.CommandText = "IFSAPP.PURCHASE_ORDER_LINE_API.GET_DUE_AT_DOCK";
_cmdDueAtDock.Parameters.Add(new OleDbParameter() {
ParameterName = "rv_",
OleDbType = OleDbType.Decimal,
Direction = ParameterDirection.ReturnValue
});
_cmdDueAtDock.Parameters.Add(new OleDbParameter() {
ParameterName = "order_no_",
OleDbType = OleDbType.VarChar,
Size = 50,
Direction = ParameterDirection.Input,
Value = _order_line.ORDER_NO
});
_cmdDueAtDock.Parameters.Add(new OleDbParameter() {
ParameterName = "line_no_",
OleDbType = OleDbType.VarChar,
Size = 50,
Direction = ParameterDirection.Input,
Value = _order_line.LINE_NO
});
_cmdDueAtDock.Parameters.Add(new OleDbParameter() {
ParameterName = "release_no_",
OleDbType = OleDbType.VarChar,
Size = 50,
Direction = ParameterDirection.Input,
Value = _order_line.RELEASE_NO
});
try {
_cmdDueAtDock.ExecuteNonQuery();
dueAtDock = Convert.ToDecimal(_cmdDueAtDock.Parameters["rv_"].Value);
} catch (Exception ex) {
dueAtDock = 0;
}
}
我使用Oracle client 11.2.0
和Oracle數據庫版本是10.2.0.4.0
。
我讀到過有問題11.1客戶端,我實際上是能夠通過select to_char(function) from dual
到sumulate與11.1客戶端的行爲 - 我得到一個正確的結果,而不to_char
但to_char
一個0
。將我的客戶端升級到11.2可以在本地解決此問題。
你能展示你的SP定義嗎? –
我在想這個11.1的錯誤讓我覺得這是別人的錯 - 不是我的:/ –