need a help
am 13.09.2005 11:33:53 von rod082--0-1551227092-1126604033=:25655
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
hello , i am a new perl programmer and i work in a nested loops that each lop excutes an sql to get a result ( 1 - M )relationship. but i faced problem: that i must finish the excute the parent sql before continuing fetching the childs results.
sql format:
-------------------------------
my ($sql)=qq
{
SELECT $fields
FROM $tables
WHERE $condition
ORDER BY $OB DESC
};
my ($sth)=$dbh->prepare($sql);
$sth->execute() || bail_out("Connt prepare retrive accounts query");
while(@arr1=$sth->fetchrow_array())
{
push(@result,[@arr1]);
#=================
my ($sql_2)=qq
{
SELECT $fields
FROM $tables
WHERE $condition depending on the parent specific result
ORDER BY $OB DESC
};
my ($sth_2)=$dbh->prepare($sql_2);
$sth_2->execute() || bail_out("Connt prepare retrive accounts query");
while(@arr2=$sth_2->fetchrow_array())
{
push(@result2,[@arr2]); }
$sth_2->finish();
#====================
}
$sth->finish();
return @result;
#============
my regards
Dakka, Rami
---------------------------------
Yahoo! for Good
Click here to donate to the Hurricane Katrina relief effort.
--0-1551227092-1126604033=:25655--