Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ORA-02074; Oracle bug?

DavidNilsMay 15 2007
Hi. I ran into a error when I tried to execute a SP in my Oracle 10g from my ASP.NET-application.

ORA-02074: Cannot SET TRANSACTION in a distributed transaction. (translated from swedish)

The procedure obviously uses transaction as so:

CREATE OR REPLACE PACKAGE BODY SP_REFRESH AS

PROCEDURE RefreshSelected(p_region NUMBER)
IS
BEGIN

COMMIT;
DBMS_TRANSACTION.use_rollback_segment('E_JOB');

bp_sbs.logaction('RefreshSelected', 'REFRESH', 'START');
commit;

update xxx set status=null where status='T' and mekod like '1%' and length(y)=6;
commit;

bp_sbs.logaction('RefreshSelected', 'Presnapshots', 'Start');
sp_misc.refreshsnapshot('S_MySnap');

bp_sbs.logaction('RefreshSelected', 'Presnapshots', 'End');

commit;
DBMS_TRANSACTION.use_rollback_segment('E_JOB');

-- Regioner --
IF p_region = 1 THEN
bp_sbs.logaction('RefreshSelected', 'Region', 'Start');
sp_misc.refreshsnapshot('S_anothersnap');

commit;
DBMS_TRANSACTION.use_rollback_segment('E_JOB');
END IF;


EXCEPTION
WHEN NO_DATA_FOUND THEN
Null;
WHEN OTHERS THEN
-- Consider logging the error and then re-raise
RAISE;
END RefreshSelected;

END SP_Refresh_New;




I've tried too find a solution to this and I have googled som on the subject. Som sites imply that this is a oracle bug. Could it be so? Other have sugested thatit is a provider error and that I should add "Enlist=False" to my connectionstring, wich didn't help.

How can I go about solving this issue?

Here's my C#-code:

OracleConnection oraConn = DbOracleManager.GetConnection();
OracleCommand cmd = oraConn.CreateCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "SP_REFRESH.RefreshSelected";

cmd.Parameters.Add(new OracleParameter("p_region", OracleType.Number));

int id;
try
{
oraConn.Open();
cmd.ExecuteNonQuery();
}
catch(Exception ex)
{
return false;
}
finally
{
oraConn.Close();
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 12 2007
Added on May 15 2007
0 comments
314 views