db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John English <john.fore...@gmail.com>
Subject Re: retrieving records based on a single column contents
Date Sun, 03 May 2015 09:51:39 GMT
On 03/05/2015 07:05, Bob M wrote:
> Thanks John
> col3 is defined as INT with no contraints but I can't do
> psInsert.setINT(3, NULL);
> NULL cannot be resolved to a variable ?

If you're doing it from Java rather than IJ, NULL is the usual Java null (a 
keyword in lowercase, and not a variable). Assuming psInsert is a 
PreparedStatement, you need to say psInsert.setNull(3,java.sql.Types.INTEGER) 
instead of using setInt (and not setINT as you spelt it!).

It will also work IIRC if you use setString:
   psInsert.setString(3,""+n);	// ...where n is an int

John English

View raw message