We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
latest
mcr.microsoft.com/mssql/server:2022-latest
any
no
Stored procedure call return wrong BigDecimal scale.
Return type defined scale
Return wrong scale.
var stmt = connection.createStatement(); stmt.execute(""" create procedure test_bigdecimal @big_decimal_type decimal(15, 3) , @big_decimal_type_o decimal(15, 3) output as begin set @big_decimal_type_o = @big_decimal_type; end; """); var call = connection.prepareCall(""" {call test_bigdecimal(100.241, ?)}"""); call.registerOutParameter(1, Types.DECIMAL); call.execute(); var actual = call.getBigDecimal(1); var expected = new BigDecimal("100.241"); Assertions.assertEquals(expected, actual);
This example shows that driver returns 4 scale instead of 3. So here is example driver returns 4 scale instead of 5:
var stmt = connection.createStatement(); stmt.execute(""" create procedure test_bigdecimal @big_decimal_type decimal(15, 5) , @big_decimal_type_o decimal(15, 5) output as begin set @big_decimal_type_o = @big_decimal_type; end; """); var call = connection.prepareCall(""" {call test_bigdecimal(100.24112, ?)}"""); call.registerOutParameter(1, Types.DECIMAL); call.execute(); var actual = call.getBigDecimal(1); var expected = new BigDecimal("100.24112"); Assertions.assertEquals(expected, actual);
I think there is some place in driver fixing scale.
(1) Expected :100.241 Actual :100.2410 (2)
Expected :100.24112 Actual :100.2411
The text was updated successfully, but these errors were encountered:
While this is investigated further, does the below workaround help?
Changing
call.registerOutParameter(1, Types.DECIMAL);
to
call.registerOutParameter(1, Types.DOUBLE);`
Sorry, something went wrong.
No branches or pull requests
Driver version
latest
SQL Server version
mcr.microsoft.com/mssql/server:2022-latest
Client Operating System
any
JAVA/JVM version
any
Table schema
no
Problem description
Stored procedure call return wrong BigDecimal scale.
Expected behavior
Return type defined scale
Actual behavior
Return wrong scale.
Error message/stack trace
This example shows that driver returns 4 scale instead of 3.
So here is example driver returns 4 scale instead of 5:
I think there is some place in driver fixing scale.
Any other details that can be helpful
JDBC trace logs
(1)
Expected :100.241
Actual :100.2410
(2)
Expected :100.24112
Actual :100.2411
The text was updated successfully, but these errors were encountered: