当我使用我的C#代码运行pl / sql查询[通过存储过程]时,我收到一个错误: 我该如何解决?请告知。 注意:我在代码中为providerSpecificTypes传递false。
Error Message:
System.Data.OracleClient.OracleException: OCI-22053: overflow error
at System.Data.Common.DbDataAdapter.FillErrorHandler(Exception e, DataTable dataTable, Object[] dataValues)
at System.Data.Common.DbDataAdapter.FillLoadDataRowChunk(SchemaMapping mapping, Int32 startRecord, Int32 maxRecords)
at System.Data.Common.DbDataAdapter.FillFromReader(Object data, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
以下是代码:
DataSet ds = new DataSet();
try
{
this.OpenDBConnection();
this.dbAdapter.ReturnProviderSpecificTypes = providerSpecificTypes;
this.dbAdapter.Fill(ds);
}
catch
{
throw;
}
finally
{
CloseDBConnection();
this.cmd.Parameters.Clear();
}
return ds;
查询:
SELECT client_id, TO_CHAR (business_dt, 'MM/DD/YYYY') AS business_dt
, mkt_type
, mkt_name
, product_name
, period
, TO_CHAR (start_dt, 'MM/DD/YYYY') AS start_dt
, TO_CHAR (end_dt, 'MM/DD/YYYY') AS end_dt
, duration
, term
, NULL AS strike_price
, instrument_type
, final_price
, NULL AS product_price
, units
, NULL AS expiry_dt
, mkt_close
, cons_flag
答案 0 :(得分:28)
所选列值之一的精度超出.Net的十进制类型。解决此问题的最佳方法是将列值ROUND为可管理的预设大小。通常我将它们四舍五入到小数位的2位数,因为我不需要它,你可能想根据你的需要选择。
简而言之,更改您的查询,以便将具有更高精度数的所有列四舍五入到您需要的小数位数:
示例:
Select ROUND(final_price, 2) From <your table>
应解决您的问题。