절차 외부에서 잘 작동하는 것으로 보이지만 절차 내부에서는 아무 것도하지 않는 것 같습니다. 절차는 오류없이 실행되고 실행되지만 행은 삽입되지 않습니다. 아무도 도와 줄 수 없습니까?실행 즉시 삽입을 사용하여
create or replace procedure sp_retail_transaction_insert
authid current_user
as
begin
execute immediate ('
insert into sp_retail_transaction
(indiv_id, perm_id, acct_type, acct_source, tender_cd, trans_header_id, trans_datetime_full,
trans_type, tot_price_amt, promotion_code, store_name, store_type, store_cat, store_terminal_location, store_area_location, cmp_period, staff)
select
a.indiv_id,
a.perm_id,
a.acct_type,
a.acct_source,
a.tender_cd,
a.trans_header_id,
a.trans_datetime_full,
a.trans_type,
a.tot_price_amt,
a.promotion_code,
a.company_name as store_name,
a.site_type as store_type,
a.secondary_site_type as store_cat,
a.airport_terminal as store_terminal_location,
a.building_desc as store_area_location,
case when
trans_datetime_full between to_date(b.start_date, ''dd/mm/yyyy'')
and
to_date (b.end_date, ''dd/mm/yyyy'') then ''cmp_period''
when to_date(trans_datetime_full, ''dd/mm/yyyy'')<to_date(b.start_date, ''dd/mm/yyyy'') then ''pre_cmp_period''
when to_date(trans_datetime_full, ''dd/mm/yyyy'')>to_date(b.end_date, ''dd/mm/yyyy'') then ''post_cmp_period''
end as cmp_period,
case when c.staff_flag = 1 or c.staff_flag_revised = 1 or c.pseudo_staff_flag = 1 then 1 else 0 end as staff
from sp_temp b, tableau.an_retail_trans_full a
left join tableau.an_individual_tb_full c
on a.indiv_id=c.indiv_id
where a.tot_price_amt>0 and
a.indiv_id is not null and
( instr ('','' || upper(b.airport_terminal)|| '','', '','' ||upper(a.airport_terminal)|| '','') <> 0 or upper(b.airport_terminal) is null) and
( instr ('','' || upper(b.store_name) || '','', '','' || upper(a.loc_desc_long) || '','') <> 0 or upper(b.store_name) is null) and
( instr ('','' || upper(b.acct_type) || '','' , '','' || upper(a.acct_type) || '','') <> 0 or upper(b.acct_type) is null) and
( instr ('','' || upper(b.trans_type) || '','', '','' || upper(a.trans_type) || '','') <> 0 or upper(b.trans_type) is null)
and
a.trans_datetime_full between (to_date(b.start_date,''dd/mm/yyyy'')-(to_date (b.end_date,''dd/mm/yyyy'') - to_date(b.start_date,''dd/mm/yyyy'')))
and
(to_date (b.end_date,''dd/mm/yyyy'')+(to_date (b.end_date, ''dd/mm/yyyy'') - to_date(b.start_date, ''dd/mm/yyyy'')))');
end sp_retail_transaction_insert;
왜 동적 SQL을 사용합니까? – mustaccio
커밋하는 것을 잊지 마십시오. –
코딩을 위해 SQL Developer를 사용하고 있습니다. –