Trouble with NULL
От | Hoanui Morangie |
---|---|
Тема | Trouble with NULL |
Дата | |
Msg-id | [email protected] обсуждение исходный текст |
Ответы |
Re: Trouble with NULL
|
Список | pgsql-jdbc |
Hi,
could anybody help me please with the following problem: I am using Postgres 7.2 on Mandrake Linux 8.2 with JDK 1.4. My table:
Query: select * from data where variant_id is null;
works fine - selects one row.
In my java code:
It works if the parameter is not null. If the parameter is null query returns no row (should return one). What's wrong?
Thank you
Hoanui
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
could anybody help me please with the following problem: I am using Postgres 7.2 on Mandrake Linux 8.2 with JDK 1.4. My table:
create table data
(
id text primary key,
...
variant_id text null,
...
);
Query: select * from data where variant_id is null;
works fine - selects one row.
In my java code:
...
String query = "select * from data where variant_id = ?";
...
PreparedStatement pstmt = con.PrepareStatement(query);
if (parameter == null)
{
pstmt.setNull(0, java.sql.Types.VARCHAR);
}
else
{
pstmt.setObject(0, parameter);
}
...
It works if the parameter is not null. If the parameter is null query returns no row (should return one). What's wrong?
Thank you
Hoanui
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
В списке pgsql-jdbc по дате отправления: