CREATE OR REPLACE Procedure REPORTDB.IAL_C_LEASING_DET_UNORD_IFS_PROC
IS
CURSOR cur
IS
(
--last create and modify by Md. Quium Hossain
--modify date 11-09-2022 9:20 AM
--this procedure is use (1)IAL_C_LEASING_CUSTOMER_ORDER_IFS_PROC
--this procedure is use (2)IAL_C_LEASING_DET_UNORD_IFS_PROC
--this procedure is use (3)IAL_C_CO_COLLECTION_DETAIL_FULL_PROC
SELECT t.company,
t.order_no,
t.identity,
t.invoice_id,
t.installment_id,
t.due_date,
t.open_amount,
t.curr_amount,
t.state ,
(SELECT MAX(due_date) last_date FROM ifsapp.ial_leasing_det_view@prod l
WHERE t.order_no=l.order_no) last_instal_date,
t.c_interest_amount
FROM ifsapp.IAL_C_LEASING_DET_UNORD_VIEW@prod t
);
BEGIN
EXECUTE IMMEDIATE 'TRUNCATE TABLE reportdb.IAL_C_LEASING_DET_UNORD_TAB_IFS';
commit;
FOR rec IN cur
LOOP
INSERT INTO reportdb.IAL_C_LEASING_DET_UNORD_TAB_IFS(
company ,
order_no ,
identity ,
invoice_id ,
installment_id ,
due_date ,
open_amount ,
curr_amount ,
state ,
last_instal_date ,
c_interest_amount
)
VALUES(
rec.company ,
rec.order_no ,
rec.identity ,
rec.invoice_id ,
rec.installment_id ,
rec.due_date ,
rec.open_amount ,
rec.curr_amount ,
rec.state ,
rec.last_instal_date ,
rec.c_interest_amount
);
END LOOP;
COMMIT;
END;
/
No comments:
Post a Comment