The XA_END function is used to dissociate the current session from the transaction branch specified by xid.
The transaction manager calls XA_END when the control thread completes or needs to pause the transaction on the transaction branch. This is typically done when the application has partially or fully completed its work, such as before blocking an event to allow other control threads to work on the branch. After XA_END returns successfully, the control thread is no longer effectively associated with the branch, but the branch still exists.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
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 Constants used in the flag field of the XA_START and XA_END functions. |
Return value
For more information, see Possible constant return values of DBMS_XA.
Possible error codes: XAER_RMERR, XAER_RMFAILED, XAER_NOTA, XAER_INVAL, XAER_PROTO, or XA_RB\*.
Considerations
You can specify
TMSUCCESSorTMSUSPENDinflag. If the return value isXA_OK, the transaction branch is dissociated from the current session.TMFAILis not supported. You can callXA_ENDwithTMSUCCESSorTMSUSPENDto dissociate the transaction branch identified byxidfrom the current session.If
XA_ENDis executed successfully, it returnsXA_OK. The application must check the return value and handle any errors. The application should only proceed with other normal operations ifXA_OKis returned.Executing the
ROLLBACKstatement before callingXA_ENDwill roll back the changes made by the current transaction. However, the transaction context is still associated with the current session beforeXA_ENDis called.Executing the
COMMITstatement before callingXA_ENDwill result in the errorOBE-02089: COMMIT is not allowed in a subordinate session.Executing the
COMMITorROLLBACKstatement afterXA_ENDhas no effect on the transaction identified byxid, as it is no longer associated with the current session. To commit or rollback the transaction specified byxid, use the transaction ID or theXA_ROLLBACKfunction.
