On 07/12/11 1:57 AM, Martin J. Evans wrote:
On 12/07/11 08:32, ZhangJun wrote:

my $dbh = DBI->connect();
my $sth1 = $dbh->prepare( $sql_a );
my $sth2 = $dbh->prepare( $sql_b );

$sth1->execute;
$sth2->execute;

while ( my ($id) = $sth1->fetchrow_array ) {
       $sth2->execute( $id )
}


# is it possible ?

Sometimes. Depends on which DBD you are using and then sometimes it depends on which driver you are using under that DBD.

You'll need to tell us which DBD (and possibly driver) you are using.

I might also comment that you can generally achieve that sort of operation via a single statement using a SQL JOIN, and do so far more efficiently than what you show above, as it will reduce round trips to the database.

--
john r pierce                            N 37, W 122
santa cruz ca                         mid-left coast

Reply via email to