Hi Noel,
 

> Because PreparedStatement is "prepared" before the setLong method is 
> called. Unfortunately, that's just how the API 

works, at preparation time we don't have access to type information about 
> the parameters and it has to be inferred.


Can you elaborate a bit on this?

At the time PreparedStatement#executeUpdate is invoked the parameters have 
already been set therefore the query execution engine has the knowledge of 
all parameters and their types.
After all, the thing blows while evaluating conditions in 
org.h2.command.dml.Delete:72, and the list of parameters is available in 
there at that point.

To reiterate another point I've already made:

Also keep in mind that, as stated in the original comment and demonstrated 
> in sample project, this statement executes just fine when there are no 
> records in the table.

IMO the syntactic correctness of the expression in WHERE clause should not 
> depend on the contents of the table.


IMO this shows the query execution engine is not doing this the right way.

you could also try something like


> delete from test

where big_number - ? < small_number * 1000


I'm not too keen on resorting to such workaround since it could have an 
effect on execution plan on other RDBMSs.
Also I've found that this kind of problem is only present with H2 and Derby.

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to