pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Inserting values into numeric fields
2+ messages / 2 participants
[nested] [flat]

* Inserting values into numeric fields
@ 2002-04-11 22:16 Eric Carpenter <postgresql@slacker.to>
  2002-04-12 00:00 ` Re: Inserting values into numeric fields Jason Earl <jason.earl@simplot.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Eric Carpenter @ 2002-04-11 22:16 UTC (permalink / raw)
  To: pgsql-sql

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?

Thanks!
Eric Carpenter





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Inserting values into numeric fields
  2002-04-11 22:16 Inserting values into numeric fields Eric Carpenter <postgresql@slacker.to>
@ 2002-04-12 00:00 ` Jason Earl <jason.earl@simplot.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Jason Earl @ 2002-04-12 00:00 UTC (permalink / raw)
  To: Eric Carpenter <postgresql@slacker.to>; +Cc: pgsql-sql

"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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2002-04-12 00:00 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-04-11 22:16 Inserting values into numeric fields Eric Carpenter <postgresql@slacker.to>
2002-04-12 00:00 ` Jason Earl <jason.earl@simplot.com>

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