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. Advertisements

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:
    584
    Kris Wempa
    Oct 1, 2003
  2. Subba Rao via DotNetMonster.com

    script for moving rows up and down and traverse thru rows of HTML table

    Subba Rao via DotNetMonster.com, Mar 19, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    8,789
    Subba Rao via DotNetMonster.com
    Mar 19, 2005
  3. helpful sql
    Replies:
    0
    Views:
    1,037
    helpful sql
    May 19, 2005
  4. Gilles Ganault

    [SQL] Pick random rows from SELECT?

    Gilles Ganault, Sep 21, 2009, in forum: Python
    Replies:
    3
    Views:
    769
    Gilles Ganault
    Sep 23, 2009
  5. Ed Garcia
    Replies:
    4
    Views:
    312
    Guinness Mann
    Aug 7, 2003
  6. palmiere
    Replies:
    1
    Views:
    666
    Erwin Moller
    Feb 9, 2004
  7. Julia deSilva

    $dbh->tables() returns nothing

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

    Perl / DBH

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