Is it possible to do nested queries with DBD::ODBC?
I have been taking the first query, throwing the results into a hash, then looping through the hash for the next query. It just seems there should be a more efficient way.
If I just nest the queries I get an error that the execute statement is already busy...
This is what causes the error:
Anyone know a more betterer
way than creating a hash from the first result set then looping through that hash?
I have been taking the first query, throwing the results into a hash, then looping through the hash for the next query. It just seems there should be a more efficient way.
If I just nest the queries I get an error that the execute statement is already busy...
This is what causes the error:
Code:
my $query = "exec sp_getSomeList";
my $sth = $dbh->prepare($query);
$sth->execute();
while(my $row = $sth->fetchrow_hashref)
{
my $query2 = "exec sp_getSomeDetails $row->{'ID'}";
my $sth2 = $dbh->prepare($query2);
$sth2->execute;
while(my $row2 = $sth2->fetchrow_hahsref)
{
## do dome stuff
}
}
Anyone know a more betterer