in reply to DBI efficient loop?
So now your in a while loop and depending on the name of each field you can access it by calling $hash_ref->{NAME_OF_FIELD} and it loops through the entire table. Hope this helps.$dbi_dsn = "dbi:ODBC:<Name of Database>"; ############################# # connect to database $dbh = DBI->connect($dbi_dsn) or die "Can't connect to $dbi_dsn: $DB +I::errstr"; $sth = $dbh->prepare(“Call you query here”); $sth->execute(); while ($hash_ref = $sth->fetchrow_hashref) { $field_1_value = $hash_ref->{Field1}; ... $field_4_value = $hash_ref->{Field4}; }
|
|---|