pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ghislain Bob Hachey <ghachey@pipolfastaem.gov.sb>
To: pgsql-admin@postgresql.org
Subject: Insert NULL value with to_numeric()
Date: Thu, 20 Jul 2006 11:51:54 +1100
Message-ID: <1153356715.2234.342.camel@informationmanagement.pfnet.local> (raw)

Hello all,

I'm a newbie.  PostgreSQL 8.1.4. Fedora Core 5.

I'm writing a small java application that will import CSV txt files into
my DB.  The SQL statement I'm sending to pgsql looks like this:

"INSERT into table (col1,col2,col3) values (to_number(?,
'999'),to_timestamp(?, 'MM/DD/YYYY HH24:MI:SS'),to_number(?, '9999');

Values are taken from a String array.

sometimes in col3 (smallint in pgsql DB) I need to insert a NULL value
but when I do I get the following error message:

invalid input syntax for type numeric: " "

I've search the archives and Internet and found similar situations but I
guess not experienced enough to fix this myself with info that I've
found.

Any help would be greatly appreciated.

Regards,

Ghislain Hachey

 




view thread (3+ messages)  latest in thread

Message-ID: <1153356715.2234.342.camel@informationmanagement.pfnet.local>
Permalink:  ../1153356715.2234.342.camel@informationmanagement.pfnet.local/
Also on:    postgresql.org/message-id/1153356715.2234.342.camel@informationmanagement.pfnet.local

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: ghachey@pipolfastaem.gov.sb
  Subject: Re: Insert NULL value with to_numeric()
  In-Reply-To: <1153356715.2234.342.camel@informationmanagement.pfnet.local>
  References: <1153356715.2234.342.camel@informationmanagement.pfnet.local>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox