Note - Steps from Down to Up --
commit;
DECLARE
CURSOR C1 IS SELECT * FROM NBB_EXT_ACC_ID;
BEGIN
FOR C1_REC IN C1
LOOP
update pay_external_accounts pea set segment3 = C1_REC.ACCOUNT_NO where pea.external_account_id = C1_REC.EXTERNAL_ACCOUNT_ID;
DBMS_OUTPUT.PUT_LiNE(C1_REC.ACCOUNT_NO || ' - ' ||C1_REC.EXTERNAL_ACCOUNT_ID );
END LOOP;
END;
SELECT * FROM NBB_EXT_ACC_ID
CREATE TABLE NBB_EXT_ACC_ID AS(
Select EMPLOYEE_NUMBER,
-- '0' || segment3 account_no ,
(SELECT ACCOUNT_NO FROM NBB_ACCOUNT_INFO where EMP_NO = EMPLOYEE_NUMBER ) ACCOUNT_NO,
pea.external_account_id
FROM per_all_people_f ppf,
per_all_assignments_f paf,
pay_personal_payment_methods_f pppm,
pay_external_accounts pea
WHERE pppm.external_account_id = pea.external_account_id
AND ppf.person_id = paf.person_id
AND pppm.assignment_id = paf.assignment_id
AND pppm.business_group_id = ppf.business_group_id
AND TRUNC (SYSDATE) BETWEEN ppf.effective_Start_Date
AND ppf.effective_end_date
AND TRUNC (SYSDATE) BETWEEN paf.effective_start_Date
AND paf.effective_end_date
AND TRUNC (SYSDATE) BETWEEN pppm.effective_start_date
AND pppm.effective_end_date
AND paf.business_group_id = 81
and ppf.EMPLOYEE_NUMBER IN (SELECT EMP_NO FROM NBB_ACCOUNT_INFO)
and pppm.org_payment_method_id = 61 )
SELECT * FROM NBB_Account_info
create table NBB_ACCOUNT_INFO
( EMP_NO VARCHAR2(5) , ACCOUNT_NO VARCHAR2(15) ) ;
INSERT INTO NBB_Account_info VALUES ('154454556','0266448895');
INSERT INTO NBB_Account_info VALUES ('154545968','0273123564');
INSERT INTO NBB_Account_info VALUES ('115445440','0274278774');
No comments:
Post a Comment