Re: Inserting values into numeric fields

From: Jason Earl <jason(dot)earl(at)simplot(dot)com>
To: "Eric Carpenter" <postgresql(at)slacker(dot)to>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Inserting values into numeric fields
Date: 2002-04-12 00:00:15
Message-ID: 87y9ft23cg.fsf@npa01zz001.simplot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Eric Carpenter" <postgresql(at)slacker(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Markus Wagner 2002-04-12 06:11:54 How to get more detailed error messages?
Previous Message Josh Berkus 2002-04-11 23:16:32 Re: [SQL] Transactional vs. Read-only (Retrieval) database