my $sth1 = $dbh->prepare("select d_id, c_id from d where d_id = ?"); $sth1->execute( $did1 ); my $sth2 = $dbh->prepare("select d_id, c_id from d where d_id = ?"); $sth2->execute( $did2 );