Re: how to select rows with $dbh->do($sql)

Discussion in 'Perl' started by Scott Lander, Jul 11, 2003.

  1. Scott Lander

    Scott Lander Guest

    Can't use "do" for a select, for this very reason - it does not retrun the
    data.

    <> wrote in message
    news:...
    > I've read that doing do($sql) is faster than doing a prepare and
    > excute, except I can't find how to select the rows in a table.
    >
    > Something like the following
    >
    > $sql = "select fieldA, fieldB from table"
    > my $row = $dbh->do($sql) or die "select failed";
    >
    > I can't see how to get the while to loop through the data the select
    > would return
    >
    > while ( $row = fetchrow_hashref )
    > { fieldAreturned = $row->(fieldA);
    > fieldBretruned = $row->(fieldB)
    > }
    >
    > thanks
    Scott Lander, Jul 11, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ravi
    Replies:
    6
    Views:
    461
    Kris Wempa
    Oct 1, 2003
  2. Gilles Ganault

    [SQL] Pick random rows from SELECT?

    Gilles Ganault, Sep 21, 2009, in forum: Python
    Replies:
    3
    Views:
    653
    Gilles Ganault
    Sep 23, 2009
  3. palmiere
    Replies:
    1
    Views:
    396
    Erwin Moller
    Feb 9, 2004
  4. Julia deSilva

    $dbh->tables() returns nothing

    Julia deSilva, Dec 17, 2003, in forum: Perl Misc
    Replies:
    3
    Views:
    110
    Bryan Castillo
    Dec 18, 2003
  5. The Magnet

    Perl / DBH

    The Magnet, Aug 14, 2009, in forum: Perl Misc
    Replies:
    2
    Views:
    100
    Xho Jingleheimerschmidt
    Aug 15, 2009
Loading...

Share This Page