- Mailing list pgsql-novice

From Mace, Richard
Subject
Date
Msg-id 07D7DD4F541A1743843C313080B3FB1A47A99B@frdads01.lorien.co.uk
Whole thread Raw
Responses Re:
Re:
List 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
inerror, please notify us immediately by reply email and then delete it from your system. Please do not copy it or use
itfor any purposes, or disclose its contents to any other person or store or copy this information in any medium. The
viewscontained in this email are those of the author and not necessarily those of Lorien plc. 

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


pgsql-novice by date:

Previous
From: joseph speigle
Date:
Subject: Re: really in neeed of help...queston about libpxx
Next
From: Oliver Elphick
Date:
Subject: Re: