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
or
psInsert.setString(3,null);
--
John English
|