diff --git a/native/src/main/java/io/ballerina/stdlib/sql/parameterprocessor/AbstractStatementParameterProcessor.java b/native/src/main/java/io/ballerina/stdlib/sql/parameterprocessor/AbstractStatementParameterProcessor.java index 260aedea..e4332f22 100644 --- a/native/src/main/java/io/ballerina/stdlib/sql/parameterprocessor/AbstractStatementParameterProcessor.java +++ b/native/src/main/java/io/ballerina/stdlib/sql/parameterprocessor/AbstractStatementParameterProcessor.java @@ -211,6 +211,8 @@ public int setSQLValueParam(Connection connection, PreparedStatement preparedSta boolean returnType) throws DataError, SQLException { try { if (object == null) { + // If the value is null, we need to set the correct SQL type for the null value + // https://github.com/ballerina-platform/ballerina-library/issues/6562 preparedStatement.setNull(index, Types.NULL); return Types.NULL; } else if (object instanceof BString) {