Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.5.4
-
None
-
Windows XP
Description
Running this script:
import groovy.sql.Sql Sql sql = Sql.newInstance("jdbc:oracle:oci:@???, "???", "???", "oracle.jdbc.driver.OracleDriver") sql.execute "CREATE TABLE TEST (A INT, B INT)" sql.execute " insert into test (A,B) values (?,?)", [10, 20] // works OK sql.execute " insert into test (A,B) values (?,?)", [10, null] // fails
Results in:
Caught: java.sql.SQLException: ORA-01008: not all variables bound at test.run(test.groovy:11) at test.main(test.groovy)
AFAIK, th problem lies with the following code (groovy.sql.Sql.java: 1390)
if (value != null) { setObject(statement, i++, value);
I think it should be
if (value != null) { setObject(statement, i++, value); else statement.setNull(i, in.getType());
Attachments
Issue Links
- is related to
-
GROOVY-2146 Can't insert null values into database
- Closed