From: "Mace, Richard" <richard(dot)mace(at)Lorien(dot)co(dot)uk>
To: <pgsql-novice(at)postgresql(dot)org>
Subject:
Date: 2003-12-18 08:40:15
Message-ID: 07D7DD4F541A1743843C313080B3FB1A47A99B@frdads01.lorien.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Good morning,

This may well be a daft question, but I'm confused and I can't find anything referring to this in the PostgreSQL
or DBI books, bear with me, I'm new.

I have one table containing a respondents contact details, e.g. name, address fields, telephone numbers, etc.
Some of the telephone number cells are blank/ empty. When I query in psql, using
"SELECT telephone from sample" the return shows all columns, including the blanks (as expected).

Using the Perl DBI I try to pull out telephone again and bind the result to a pre-defined variable $telephone.
e.g.

$sth = $dbh->prepare("SELECT telephone from sample");
$sth->execute();
$sth->bind_columns(undef, \$telephone);
while ( $sth->fetch ) {
print STDERR "$telephone\n";
}
$sth->finish;

This fails with "Statement has no result to bind(perhaps you need to call execute first)"

This code works fine for a field that is always populated e.g. name in place of telephone in line 1.

Is my code fatally flawed or do I need to deal with the blank cells differently when the data is written to the
database in the beginning, or before the bind. Any help greatly appreciated.

(Running: Linux 7.2, Perl 5.6, Postgres 7.1.3, DBI 1.32.)

Richard

**********************************************************************
The information contained in this email is confidential and is intended for the recipient only. If you have received it in error, please notify us immediately by reply email and then delete it from your system. Please do not copy it or use it for any purposes, or disclose its contents to any other person or store or copy this information in any medium. The views contained in this email are those of the author and not necessarily those of Lorien plc.

Thank you for your co-operation.
**********************************************************************

Responses

  • Re: at 2003-12-18 12:49:55 from Oliver Elphick
  • Re: at 2003-12-18 14:53:21 from Michael Fuhr

Browse pgsql-novice by date

  From Date Subject
Next Message Oliver Elphick 2003-12-18 12:49:55 Re:
Previous Message joseph speigle 2003-12-18 05:46:58 Re: really in neeed of help...queston about libpxx