I see you found it... I know that the DBI docs specify that $sth->finish is in general not needed, but in the type of code that you used there is no way for DBD::Sybase to realize that there are no results after the single row fetched through the $sth2 handle (well, it
could do a look-ahead fetch, but then it would have to store the fetched row somewhere until the script calls fetch() again. Feasible, but messy).
I should probably improve the documentation a bit to be more explicit about the need to finish executions properly, either by fetching until no more rows are found, or by using finish().
Michael