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

Re: insert as null

From: "Prasanth" <dbadmin(at)nqadmin(dot)com>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: insert as null
Date: 2005-03-07 19:20:49
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
Remove the quotes on either side when inserting null value.


-----Original Message-----
From: pgsql-jdbc-owner(at)postgresql(dot)org
[mailto:pgsql-jdbc-owner(at)postgresql(dot)org]On Behalf Of Mican Bican
Sent: Monday, March 07, 2005 1:07 PM
To: pgsql-jdbc(at)postgresql(dot)org
Subject: [JDBC] insert as null


How can I store a as null in database. The problem is 
java.sql.Date date = null;
Customer cust = new Customer(id);

..insert into Customer (id..,date,...)
...." ' "+in.getSqlDate()+" ' ".....

then the exception

java.sql.SQLException: ERROR: invalid input syntax for type date: "null"

when I select a row with empty date and system.out.print, it  gives me a 
null.. but why I can't store it as null
I use jdbc3, postgresql 8.0.1 and java 5 (tiger) on windows

thank you

best regards Mican Bican

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

In response to

pgsql-jdbc by date

Next:From: David GagnonDate: 2005-03-07 19:58:45
Subject: JDBC error under RH9 for PG7.4/TOMCAT4.1 but not under WINDOWS
Previous:From: Charl GerberDate: 2005-03-07 19:07:44
Subject: postgre 7.3 / JSTL problem

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