when it isn't possible, you can create two database handles, and they can have different attributes.
my $dbhA = DBI->connect();
my $dbhB = DBI->connect();
my $sth1 = $dbhA->prepare( $sql_a );
my $sth2 = $dbhB->prepare( $sql_b );
$sth1->execute;
$dbhB->begin_work; END { $dbhB->commit}
while ( my ($id) = $sth1->fetchrow_array ) {
state $counter = 1;
$sth2->execute( $id );
$counter++ % 2000 or $dbhB->commit;
};
