[
https://issues.apache.org/jira/browse/DERBY-4749?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Knut Anders Hatlen closed DERBY-4749.
-------------------------------------
Bug behavior facts: (was: [Crash])
Resolution: Duplicate
This looks like a duplicate of DERBY-4671.
It should be possible to work around the bug by adding a cast operator around
the the parameter in the select list, like this:
INSERT INTO email2folder (idEmail,idFolder) SELECT idEmail, CAST(? AS INT) FROM
email2folder WHERE id IN (?)
> parametric insert faiure with mixed int/bigint params
> -----------------------------------------------------
>
> Key: DERBY-4749
> URL: https://issues.apache.org/jira/browse/DERBY-4749
> Project: Derby
> Issue Type: Bug
> Components: JDBC
> Affects Versions: 10.6.1.0
> Environment: Win XP - SP3 - JDK 1.6.0_17
> Reporter: RobertoC
> Priority: Blocker
>
> Derby raise an exception on the INSERT:
> INSERT INTO email2folder (idEmail,idFolder) SELECT idEmail,? FROM
> email2folder WHERE id IN (?)
> passing a java array as params-container: new Number{new Integer(12), new
> Long(1)};
> Replacing "?" with values, into INSERT, works correctly (but I must use
> params, by project requirements).
> As shown in the below table structure "idEmail" is a BIGINT while "idFolder"
> is an INTEGER.
> So params-array is supplied with two different object's classes.
> Tables:
> -----------------------------------
> CREATE TABLE email2folder (
> id bigint GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY NOT NULL,
> idemail bigint NOT NULL,
> idfolder integer NOT NULL
> );
> Exception:
> ------------------------------
> Caused by: java.lang.RuntimeException: SQL=INSERT INTO email2folder
> (idEmail,idFolder) SELECT idEmail,? FROM email2folder WHERE id IN (?)
> at
> datamgr.sql.SQLConnection.executeParameterizedUpdate(SQLConnection.java:256)
> at
> datamgr.sql.ShareableSQLConnection.executeParameterizedUpdate(ShareableSQLConnection.java:79)
> ... 7 more
> Caused by: java.sql.SQLException: Eccezione Java: ':
> java.lang.NullPointerException'.
> at
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown
> Source)
> at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown
> Source)
> at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
> at
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown
> Source)
> at
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown
> Source)
> at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown
> Source)
> at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown
> Source)
> at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(Unknown
> Source)
> at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init>(Unknown
> Source)
> at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init>(Unknown
> Source)
> at org.apache.derby.impl.jdbc.EmbedPreparedStatement40.<init>(Unknown
> Source)
> at org.apache.derby.jdbc.Driver40.newEmbedPreparedStatement(Unknown
> Source)
> at
> org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
> at
> org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
> at
> datamgr.sql.SQLConnection.executeParameterizedUpdate(SQLConnection.java:243)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.