pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jason Earl <jason.earl@simplot.com>
To: Eric Carpenter <postgresql@slacker.to>
Cc: pgsql-sql@postgresql.org
Subject: Re: Inserting values into numeric fields
Date: 11 Apr 2002 18:00:15 -0600
Message-ID: <87y9ft23cg.fsf@npa01zz001.simplot.com> (raw)
In-Reply-To: <NHEMKPHJPKCCFEHFMEJIKECKCEAA.postgresql@slacker.to>
References: <NHEMKPHJPKCCFEHFMEJIKECKCEAA.postgresql@slacker.to>

"Eric Carpenter" <postgresql@slacker.to> writes:

> Greetings all,
> 
> I'm trying to insert values into a numeric field which may be
> optional. I'm using perl's DBI and bind parameters to do
> this. However, psotgresql complains that '' is not a numeric, since
> the DBI quotes everything before inserting.. I've tried inserting
> NULL as well, but that gets quoted and rejected as well.
> 
> Is there any way to do this without hard coding "NULL" into the
> prepared statement handle?

It's been a long time since I used Perl with PostgreSQL but it seems
DBI will insert null values if you pass them variables that are
undefined.  Try using undef() and see what you get.

Good luck,
Jason



view thread (2+ messages)

Message-ID: <87y9ft23cg.fsf@npa01zz001.simplot.com>
Permalink:  ../87y9ft23cg.fsf@npa01zz001.simplot.com/
Also on:    postgresql.org/message-id/87y9ft23cg.fsf@npa01zz001.simplot.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jason.earl@simplot.com, postgresql@slacker.to
  Subject: Re: Inserting values into numeric fields
  In-Reply-To: <87y9ft23cg.fsf@npa01zz001.simplot.com>

* 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