Skip site navigation (1) Skip section navigation (2)

impossible to update rows specifying columns with NULL value?

From: Guillaume Cottenceau <gc(at)mnc(dot)ch>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: impossible to update rows specifying columns with NULL value?
Date: 2005-02-28 12:28:27
Message-ID: 87wtssj2c4.fsf@meuh.mnc.ch (view raw or flat)
Thread:
Lists: pgsql-jdbc
Hi,

I have a table with a column of type `integer'. I insert data in
this column with NULL value. The NULLs should be OK in the
database since when I perform a SELECT on this row, after a
getInt on this column (value obtained is 0), ResultSet#wasNull is
true.

The problem is when trying to UPDATE (changing values of other
columns): my PreparedStatement uses "... WHERE column = ?" to
specify the NULL value for the said column, and I set the value
with "ResultSet#setNull( 4, java.sql.Types.NUMERIC )", but when
executing the statement, no change occurs (0 rows affected).

I am using postgres 7.4.5 with postgresql-8.0-310.jdbc3.jar.

Any idea?

Thank you.

-- 
Guillaume Cottenceau

Responses

pgsql-jdbc by date

Next:From: Markus SchaberDate: 2005-02-28 14:10:11
Subject: Abandoning PGobject
Previous:From: Markus SchaberDate: 2005-02-25 21:03:00
Subject: Re: Statement level transactions

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group