Oracle Error ORA-24787: remote cursors must be closed before a call completes

Oracle Error Message

ORA-24787: remote cursors must be closed before a call completes

Reason for the Error

The previous operation did not close all the remote cursors it opened. Since separated transactions are enabled, this is not allowed.

Solution

Close all remote cursors in each call, or start a regular (non-separated) transaction.