>
>
> Yes i know that i can't, but why the transaction fails?
>
because casting fails. First FETCH was ok, and evaluating of next row
(which need second FETCH) was broken. When any statement in
transaction fail, you have to rollback current transaction.
Pavel