|
refercence :
------------------
Problem Description
-------------------
When calling the 'set_nls' in a remote procedure this causes an
ORA-02074: cannot set_nls in a distributed transaction
This can be shown with the following commands:
SQL> create database link su22v816
connect to system identified by manager
using 'su22v816';
SQL> create or replace procedure doit
as
begin
dbms_session.set_nls('NLS_LANGUAGE','dutch');
end;
/
SQL> exec doit@su22v816
BEGIN doit@su22v816; END;
*
ERROR at line 1:
ORA-02074: cannot SET NLS in a distributed transaction
ORA-06512: at "SYS.DBMS_SESSION", line 101
ORA-06512: at "SYSTEM.DOIT", line 4
ORA-06512: at line 1
SQL> exec doit
PL/SQL-procedure is geslaagd.
Solution Description
--------------------
The work around is not to set the NLS properties in the dependent session
but to use nls_dependent functions, such as nls_initcap, or apply the
relevant NLS parameters in the generic functions such as to_number.
Explanation
-----------
ORA-02074 indicates that it cannot COMMIT or ROLLBACK in a distributed
transaction.
Cause: A COMMIT or ROLLBACK was attempted from a session other than the
parent of a distributed transaction.
Action: Only the parent session can issue a COMMIT or ROLLBACK.
Most likely the set_nls procedure recursively issues a commit statement.
This is similair to the DDL statement 'alter session set'. Since the commit
and rollback of the transaction is controlled by the parent session the
dependent session is not allowed to perform a recursive commit.
The only reference found that explains this behaviour is in the book:
"Oracle Built-in Packages", it mentions:
"Restrictions on calling the procedure:SET_NLS is not allowed in remote
sessions(...)"
References
----------
SQL Reference Volume 2 A67795-01
"Oracle Built-in Packages" by S. Feuerstein et all ISBN 1565923758
Bug 1129784 ORA-2074: CANNOT SET NLS IN A DISTRIBUTED TRANSACTION
Additional Search Words
-----------------------
DB; DATABASE LINK; ORA-2074; SET_NLS; |
|