The XA_END function disassociates the current session from the transaction branch specified in xid.
The transaction manager calls XA_END when a control thread completes a transaction branch or needs to suspend the work on a transaction branch. This occurs when the application completes a part or all of its work. For example, XA_END is called before blocking some event to enable other control threads to work on the branch. After XA_END returns with success, the calling control thread is no longer associated with the branch, but the branch still exists.
Syntax
DBMS_XA.XA_END (
xid IN DBMS_XA_XID,
flag IN PLS_INTEGER)
RETURN PLS_INTEGER;
Parameters
| Parameter | Description |
|---|---|
| xid | For more information, see DBMS_XA_XID object type. |
| flag | For more information, see DBMS_XA constants for the flag field in XA_START & XA_END functions. |
Return values
For more information, see Possible constant return values for DBMS_XA.
The possible error codes are: XAER_RMERR, XAER_RMFAILED, XAER_NOTA, XAER_INVAL, XAER_PROTO, and XA_RB*.
Usage notes
You can specify
TMSUCCESSorTMSUSPENDin theflagparameter, and the transaction branch is disassociated from the current session in the detached state if the return value isXA_OK.TMFAILis not supported. You can call XA_END withTMSUCCESSorTMSUSPENDto disassociate the transaction branch specified byxidfrom the current session.If XA_END succeeds,
XA_OKis returned. An application must check the return value and handle error cases. The application can only proceed with other normal operations whenXA_OKis returned.If you execute a
ROLLBACKstatement before XA_END is called, changes made by the current transaction will be rolled back. However, the context of the transaction is till associated with the current session until you call XA_END.If you execute a
COMMITstatement before XA_END is called, the following error will be returned:ORA-02089: COMMIT is not allowed in a subordinate session.If you execute a
COMMITorROLLBACKstatement after XA_END is called, the execution does not have any effect on the transaction specified byxidbecause it is no longer associated with the current session. In this case, you can commit the transaction ID or call the XA_ROLLBACK function to commit or rollback the transaction specified byxid.