Loading

The conversion from String to DECIMAL is unsupported

Publiceringsdatum: Aug 1, 2025
Lösning

SYMPTOM

When attempting to communicate with a Microsoft SQL Server with a parameterized stored procedure execution fails and the following is observed in the logs:
com.microsoft.sqlserver.jdbc.SQLServerException: The conversion from String to DECIMAL is unsupported.
	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190)
	at com.microsoft.sqlserver.jdbc.DataTypes.throwConversionError(DataTypes.java:1117)
	at com.microsoft.sqlserver.jdbc.AppDTVImpl$SetValueOp.execute(dtv.java:1221)
	at com.microsoft.sqlserver.jdbc.DTV.executeOp(dtv.java:1009)
	at com.microsoft.sqlserver.jdbc.AppDTVImpl.setValue(dtv.java:1505)
	at com.microsoft.sqlserver.jdbc.DTV.setValue(dtv.java:89)
 

CAUSE

This is caused by passing a non-decimal value to the query where a decimal value is expected. 

SOLUTION

The root cause of this error is that the data provided can not be accepted as a decimal value. Common solutions to this are to: 
  • Check that none of the values are returning an empty value. For example an XPath expression may not be returning the correct value. 
  • Confirm that all values being populated have the correct datatype and that this is a match with the stored procedure. 
  • If using Dataweave, try transforming the objects to the expected type. This might help identify the spurious value with a different error such as: 
    Cannot coerce a :string to a :number, caused by :Cannot convert "test" to a number
Knowledge-artikelnummer

001123792

 
Laddar
Salesforce Help | Article