Здрасте!
Вот такая ошибка возникает: Oracle error ORA-02046: distributed transaction already begun
Есть процедура которая вызывает другую по ДБ-линку, в результате возникает ошибка
Часть основной процедуры:
........
commit;
insert into rep_moz.rep_17_8@bi.world
select r.BAN, r.CTN, r.CONTRACT_DATE, r.MARKET_CODE from rep_17_8 r;
commit;
rep_17_8_bi@Bi.world(in_Ctrl_Period, in_Period_Start_Date, in_Period_End_Date);
insert into rep_17_8_r
select * from rep_17_8_r@Bi.world;
commit;
......
Процедура rep_17_8_bi на Bi
CREATE OR REPLACE PROCEDURE REP_17_8_BI(
in_Ctrl_Period IN NUMBER
,in_Period_Start_Date IN DATE
,in_Period_End_Date IN DATE )
is
begin
insert /*+ append*/ into rep_17_8_r
select /*+ parallel(re,8) */
re.subs_key,
round(sum(decode(re.currency,'D',nvl(re.recharge_amt,0),'P',nvl(re.recharge_amt,0)/re.conversion_rate, -- çàìåíèòü íà conversion_rate
nvl(re.recharge_amt,0))),2) as recharges_usd
, round(sum(decode(re.currency,'D',0,'P',nvl(re.recharge_amt,0),0)),2) as recharges_RUR
, tr.CONTRACT_DATE
from dwh.fct_prepaid_recharges re, (select
bb.BAN ban
, trim(bb.CTN) ctn
, bb.CONTRACT_DATE contract_date
, bb.MARKET_CODE market_code
from rep_moz.rep_17_8 bb
where 1=1
union all
select next_ban ban
, next_ctn ctn
, contract_date
, market_code
from
(select --+ ordered
su.NEXT_BAN
,su.NEXT_CTN
,bv.CONTRACT_DATE
,bv.MARKET_CODE
from rep_17_8 bv
,dim_subscriber su
where 1=1
and su.MARKET_KEY = bv.MARKET_CODE
and su.SUBS_KEY = trim(bv.CTN)
and su.BAN_KEY = bv.BAN
and su.NEXT_BAN is not null
and su.SUBS_KEY = su.NEXT_CTN
and su.PREPAID_IND = 1)) tr
where 1=1
and re.ban_key=tr.ban
and re.subs_key=tr.ctn
and re.market_key=tr.market_code
and re.recharge_date_time>=tr.CONTRACT_DATE
and re.recharge_date_time< tr.CONTRACT_DATE+in_Ctrl_Period
and re.recharge_date_time >= in_Period_Start_Date -- íà÷àëî ïåðèîäà ñ êîòîðîãî ïðîñìàòðèâàòü recharges
and re.recharge_date_time < in_Period_End_Date+in_Ctrl_Period+1
group by re.subs_key, tr.CONTRACT_DATE;
commit;
end;
В чем ошибка?