"Conversion overflows" error getting a decimal

"Conversion overflows" error getting a decimal


I am doing a simple operation of inserting a large decimal value (100000000000000000000000) into a table.
When I try to get that record it raises a exception "Conversion overflows".
Is this problem known? Is there any solution?

Thanks in advance.

Error Detail:
Message: Could not assign '' to 'TABLE.Attribute'... Conversion overflows.

at ssESPACE.ENTABLEEntityRecord.Read(IDataReader r, Int32& index)
at ssESPACE.RCTABLERecord.ReadDB(IDataReader r)
at ssESPACE.RLTABLERecordList.Read()
at ssESPACE.RLTABLERecordList.set_Reader(IDataReader value)
at OutSystems.HubEdition.RuntimePlatform.DBHelper.ExecuteQuery(RecordList rl, IDbCommand cmd, String description, Boolean transformParameters, Boolean skipLog)
at OutSystems.HubEdition.RuntimePlatform.DBHelper.NewExecuteSimpleQuery(RecordList rl, IDbCommand cmd, String description)
at ssESPACE.Flows.FlowFormulario.ScrnWebScreenEdit.FuncssPreparation.QueryGetTable(HeContext heContext, Int32 maxRecords, IterationMultiplicity multiplicity, Int32& outParamCount, Int32 qpRegistoId)
at ssESPACE.Flows.FlowFormulario.ScrnWebScreenEdit.Preparation(HeContext heContext)
at ssESPACE.Flows.FlowFormulario.ScrnWebScreenEdit.doRefreshScreen(HeContext heContext)
at ssESPACE.Flows.FlowFormulario.ScrnWebScreenEdit...utton.RaisePostBackEvent(String eventArgument)
at OutSystems.HubEdition.WebWidgets.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
OutSystems is using .Net Int32  for a Integer value. These can have a MaxValue of  2,147,483,647 and a MinValue of -2,147,483,648. 

Kind regards,

I see the problem now, the type of the column in the database table is a decimal but i think the entity attribute type is a int. As you can see in the stack-trace the OutSystems tries to convert the value in a Int32.

sollution change the type of the entity attribute.
Hi Patricia,

I replicated the problem here,
From my tests the SqlClient DataReader fails then the number exceeds 7,9 x 10^20 (7,9 x 10^28 considering the 8 decimal places).

After some search I found a little disclaimer on the bottom of the SqlDecimal documentation page that says it only actually supports 7,9 x 10^28 instead of the supposed 7,9 x 10^38 due to implemention issues.

In my opinion is a big implementation bug on the Microsoft side. The problem is not actually inserting, but reading it.

If you really need to use decimals with that size I sugest you to submit the issue to OutSystems Tecnical Support.

João Rosado
Thank you for your help.

Matthias the attribute is a decimal with Lenght=37 and Decimals=8.

João thank you for explaining the problem. I will give some feedback to outsystems.
Meanwhile i'll reduce de attribute length.

I was able to workaround this problem using the following approach:

1) having a structure to mimic the structure of your entity
2) the decimal values which you expect to have greater value than supported are converted to Text
3) use convert(varchar, [Attribute]) on the SELECT for that field
4) use TextToDecimal() on that field to convert to Decimal

You can find an example in the attached eSpace.

Best regards,
Ricardo Silva