List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:August 26 2001 2:24am
Subject:Re: Perl DBI -- How to select all returned values into an array
View as plain text  
At 10:07 AM -0700 8/24/01, Katherine Porter wrote:
>For single values I usually use this DBI function and query:
>
>   my $val =3D $dbh->selectrow_array("SELECT value FROM tab1 WHERE test=3D=
>2");
>
>However, what if I want to store a bunch of values into an array?
>
>   my @vals =3D $dbh->?????("SELECT value FROM tab1 WHERE test > 10");
>
>What's the syntax I'm missing above?  Any help appreciated!
>
>[.kate]


my $ref = $dbh->selectcol_arrayref (single-column query);
my @val = (defined ($ref) ? @{$ref} : () );

-- 
Paul DuBois, paul@stripped
Thread
Re: Perl DBI -- How to select all returned values into an arrayKatherine Porter25 Aug
  • Re: Perl DBI -- How to select all returned values into an arrayPaul DuBois26 Aug
    • Re: Perl DBI -- How to select all returned values into an arrayTim Bunce26 Aug
  • Re: Perl DBI -- How to select all returned values into an arrays. keeling26 Aug