TIBStoredProc error


I have stored procedures inside a loop.
After the first cicle all work OK.
But after a couple of cicles any of the stored procedures might give me the
error message, depending on the data selection:

SQLDA missing or incorrect version, or incorrect number/type of variables.

The parameters are OK.
I even got the same error for a stored procedure with no input parameters
left by mistake inside the loop.

Thanks for the help,