![](/img/trans.png)
[英]Executing sqlplus.exe through Process / ProcessStartInfo and returning error code when PL SQL compile error
[英]Getting overflow error when executing pl/sql query
當我使用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
所選列值之一的精度超出.Net的十進制類型。 解決此問題的最佳方法是將列值環繞到可管理的預置大小。 通常我會將它們四舍五入到小數點后兩位數字,因為我將不再需要,您可能需要根據需要進行選擇。
簡而言之,請更改查詢,以便將所有具有較高精度數字的列四舍五入為所需的小數位數:
例:
Select ROUND(final_price, 2) From <your table>
應該解決您的問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.