If the error is cursor-related, check that you close your cursors properly. For example, Java/JDBC has a very unfortunate default setting to use WITH HOLD cursors, which are not closed upon COMMIT. (And that default is used because auto-commit is another such unfortunate default.)