Странные вещи с процедурой ниже.
Когда я запускаю процедуру, она вставляет в таблицу только 125 записей. Когда я вставляю данные без процедуры с теми же параметрами, это дает мне 15000 записей. У вас есть идеи, что бы это могло быть?
create or replace procedure calc_p(p_startdate number,
p_end_date number,
p_id number) is
begin
dbms_output.put_line('Start: ' || substr(localtimestamp, 1, 17));
delete rep_pd
where b_id = p_id
and rep_date between p_startdate and p_end_date;
-- commit;
insert into rep_pd
with cont
(rep_date, b_id, con_number, okres_zap) as
(select /*+ materialize*/
rep_date,
b_id,
con_number,
nvl(maturity_date - origin_date, 0) as okres_zap
from con@sg_al
where description not in ('OVER', 'Overn')
and b_id = p_id
and rep_date between p_startdate
and p_end_date)
select mr.suffix1,
mr.data_danych,
ma.rep_date,
b_id,
mr.k_symbol,
konto_nazwa,
case
when mr.k_nazwa likr '%EXT%' then
'04'
when mr.k_symbol like '3731%' then
'12'
else
mr.typ_k_symbol
end as cl_t,
ma.okres_zap,
mr.rezydent_symbol,
mr.w_symbol as cu,
mr.sal_ma_pl as outstanding,
get_pd_account(k_symbol) AS depo substr(to_number(to_char(data_danych, 'yyyymmdd')), 7, 2) as dzien
from abc.a_mr mr
left join cont ma
on ma.b_id = p_id
and to_date(ma.rep_date, 'YY/MM/DD') = mr.data_danych
and ma.con_number = mr.suffix1
where sal_ma_pl <> 0
and get_pd_account(k_symbol) is not null
and nvl(typ_k_symbol, '20') not in ('01', '02', '02A')
and mr.data_danych between to_date(p_startdate, 'YY/MM/DD') and
to_date(p_end_date, 'YY/MM/DD');
-- commit;
dbms_output.put_line('Koniec: ' || substr(localtimestamp, 1, 17));
end calc_p;