ct_param() failed! at /tmp/xx.pl line 33. DBD::Sybase::st execute failed: OpenClient message: LAYER = (1) ORIGIN = (1) SEVERITY = (1) NUMBER = (16) Message String: ct_param(): user api layer: external error: This routine cannot be called while results are pending for a command that has been sent to the server. DBD::Sybase::st execute failed: OpenClient message: LAYER = (1) ORIGIN = (1) SEVERITY = (1) NUMBER = (16) Message String: ct_param(): user api layer: external error: This routine cannot be called while results are pending for a command that has been sent to the server. #### #!/usr/bin/perl use strict; use warnings; use DBI; my $dbh1 = DBI->connect("dbi:Sybase:server=server1;database=database1", 'user1', 'passwd1'); my $dbh2 = DBI->connect("dbi:Sybase:server=server2;database=database2", 'user2', 'passwd2'); my $sth1 = $dbh1->prepare("select * from table1"); my $sth2 = $dbh2->prepare("select * from table2 where primkey = ?"); $sth1->execute; #---- iterate through table1, check in table2 while (my @row1 = $sth1->fetchrow_array) { $sth2->execute($row1[0]); # this is line 33 my @row2 = $sth2->fetchrow_array; }