Committing Unmerge Transactions After Error Checking
Committing Unmerge Transactions After Error Checking
The Batch Unmerge stored procedure is transactional and can be rolled back if an error occurs during execution. If IN_ALLOW_COMMIT_IND = 1, Batch Unmerge executes COMMIT or ROLLBACK and cleans up all the temporary tables. If IN_ALLOW_COMMIT_IND = 0, Batch Unmerge does not execute COMMIT or ROLLBACK. After you call the Batch Unmerge job, check the return code, OUT_RETURN_CODE, in your error handler.
If any failure occurs during execution (OUT_RETURN_CODE < 0), immediately roll back any changes. Wait until after you have successfully rolled back the unmerge changes before you invoke Unmerge again.
If no failure occurs during execution (OUT_RETURN_CODE = 0), commit any unmerge changes.