Sunteți pe pagina 1din 4

/* Formatted on 9/17/2012 4:37:50 PM (QP5 v5.215.12089.

38647) */
CREATE OR REPLACE PROCEDURE DATAMART.SURESH_T_AGING_CUSTINFO (
p_customer_id IN ctsreports.ar_aging_invoices.customer_id%TYPE,
p_category IN ctsreports.ar_aging_invoices.customer_category_code%TYPE,
p_collector IN ctsreports.ar_aging_invoices.collector%TYPE,
p_nae IN ctsreports.ar_aging_invoices.nae%TYPE,
p_location IN ctsreports.ar_aging_invoices.location%TYPE,
p_cust_name IN ctsreports.all_hierarchy.customer_name%TYPE,
p_cust_nbr IN ctsreports.all_hierarchy.customer_number%TYPE)
AS
/* 10-13-4 Eva Potts
Created to perform updates of customer info in CTSREPORTS custom tables
for customers updates in RA_CUSTOMERS_ALL
Called from trigger firing after insert/update on RA_CUSTOMER_ALL
Ver Date Author Description
--------- ---------- ------------ ------------------------------------
2.0 11/12/2009 Wei W sleep and try again if UPDATE ctsreports
.ar_aging_invoices failed.
*/
BEGIN
/* Update info in AR_AGING_INVOICES */
BEGIN
UPDATE ctsreports.ar_aging_invoices
SET customer_category_code = NVL (p_category, 'No Category Assigned'),
collector = NVL (p_collector, 'Unassigned'),
nae = NVL (p_nae, 'Unassigned'),
location = p_location
WHERE customer_id = p_customer_id;
EXCEPTION
WHEN OTHERS
THEN
/* WHSELOG.JOB_PROGRESS_PKG.LOG_JOB_PROGRESS
(
pi_APPLICATION_NAME=> 'AR REPLICATION'
, pi_PROGRAM_NAME => 'DATAMART.T_AGING_CUSTINFO_UPDATES'
, pi_MESSAGE => 'SLEEP AND RETRY'
);
*/
DBMS_LOCK.SLEEP (180);
UPDATE ctsreports.ar_aging_invoices
SET customer_category_code =
NVL (p_category, 'No Category Assigned'),
collector = NVL (p_collector, 'Unassigned'),
nae = NVL (p_nae, 'Unassigned'),
location = p_location
WHERE customer_id = p_customer_id;
/* WHSELOG.JOB_PROGRESS_PKG.LOG_JOB_PROGRESS
(
pi_APPLICATION_NAME=> 'AR REPLICATION'
, pi_PROGRAM_NAME => 'DATAMART.T_AGING_CUSTINFO_UPDATES'
, pi_MESSAGE => 'RETRY SUCCESSFUL'
);*/
END;
/* Update info in AR_AGING_INVOICES_30DAY */
UPDATE ctsreports.ar_aging_invoices_30day
SET customer_category_code = NVL (p_category, 'No Category Assigned'),
collector = NVL (p_collector, 'Unassigned'),
nae = NVL (p_nae, 'Unassigned'),
location = p_location
WHERE customer_id = p_customer_id;
/* Update info in AR_INV_COUNT */
--UPDATE ctsreports.ar_inv_count
--SET customer_category_code = NVL(p_category,'No Category Assig
ned'),
-- collector = NVL(p_collector,'Unassigned'),
-- nae = NVL(p_nae,'Unassigned'),
-- location = p_location
-- WHERE customer_id = p_customer_id;
--
--/* Update info in AR_TERMS_COUNT */
--UPDATE ctsreports.ar_terms_count
--SET customer_category_code = NVL(p_category,'No Category Assig
ned'),
-- collector = NVL(p_collector,'Unassigned'),
-- nae = NVL(p_nae,'Unassigned'),
-- location = p_location
-- WHERE customer_id = p_customer_id;
/* Update info in AR_AGING_TERMS */
UPDATE ctsreports.ar_aging_terms
SET customer_category_code = NVL (p_category, 'No Category Assigned'),
collector = NVL (p_collector, 'Unassigned'),
nae = NVL (p_nae, 'Unassigned'),
location = p_location
WHERE customer_id = p_customer_id;
/* Update info in AR_AGING_TERMS_30DAY */
UPDATE ctsreports.ar_aging_terms_30day
SET customer_category_code = NVL (p_category, 'No Category Assigned'),
collector = NVL (p_collector, 'Unassigned'),
nae = NVL (p_nae, 'Unassigned'),
location = p_location
WHERE customer_id = p_customer_id;
/* Update info in AR_AGING_PMT */
UPDATE ctsreports.ar_aging_pmt
SET customer_category_code = NVL (p_category, 'No Category Assigned'),
collector = NVL (p_collector, 'Unassigned'),
nae = NVL (p_nae, 'Unassigned'),
location = p_location
WHERE customer_id = p_customer_id;
/* Update info in AR_AGING_BALDUE */
--UPDATE ctsreports.ar_aging_baldue
--SET customer_category_code = NVL(p_category,'No Category Assigned
'),
-- collector = NVL(p_collector,'Unassigned'),
-- nae = NVL(p_nae,'Unassigned'),
-- location = p_location
-- WHERE customer_id = p_customer_id;
--
--/* Update info in AR_AGING_ORIGINAL */
--UPDATE ctsreports.ar_aging_original_inv
--SET customer_category_code = NVL(p_category,'No Category Assigned
'),
-- collector = NVL(p_collector,'Unassigned'),
-- nae = NVL(p_nae,'Unassigned'),
-- location = p_location
-- WHERE customer_id = p_customer_id;
--
--/* Update info in AR_AGING_CM_DM */
--UPDATE ctsreports.ar_aging_cm_dm
--SET customer_category_code = NVL(p_category,'No Category Assigned
'),
-- collector = NVL(p_collector,'Unassigned'),
-- nae = NVL(p_nae,'Unassigned'),
-- location = p_location
-- WHERE customer_id = p_customer_id;
--
--/* Update info in AR_AGING_BILLSIC */
--UPDATE ctsreports.ar_aging_billsic
--SET customer_category_code = NVL(p_category,'No Category Assigned
'),
-- collector = NVL(p_collector,'Unassigned'),
-- nae = NVL(p_nae,'Unassigned'),
-- customer_code_location = p_location
--
-- WHERE customer_id = p_customer_id;
--
--/* Update info in AR_AGING_BILLSIC_TERMS */
--UPDATE ctsreports.ar_aging_billsic_terms
--SET customer_category_code = NVL(p_category,'No Category Assigned
'),
-- collector = NVL(p_collector,'Unassigned'),
-- nae = NVL(p_nae,'Unassigned'),
-- customer_code_location = p_location
--
-- WHERE customer_id = p_customer_id;
--
--/* Update related customer info in ALL_HIERARCHY */
--UPDATE ctsreports.all_hierarchy
--SET category = NVL(p_category,'No Category Assigned'),
-- collector = NVL(p_collector,'Unassigned'),
-- nae = NVL(p_nae,'Unassigned'),
-- related_customer_name = p_cust_name,
-- related_customer_number = p_cust_nbr
-- WHERE related_customer_id = p_customer_id;
--
--/* Update parent customer info in ALL_HIERARCHY */
--UPDATE ctsreports.all_hierarchy
--SET customer_name = p_cust_name,
-- customer_number = p_cust_nbr
-- WHERE customer_id = p_customer_id;
--
--/* Update related customer info in CAP_HIERARCHY */
--UPDATE ctsreports.cap_hierarchy
--SET category = NVL(p_category,'No Category Assigned'),
-- collector = NVL(p_collector,'Unassigned'),
-- nae = NVL(p_nae,'Unassigned'),
-- related_customer_name = p_cust_name,
-- related_customer_number = p_cust_nbr
-- WHERE related_customer_id = p_customer_id;
--
--/* Update parent customer info in CAP_HIERARCHY */
--UPDATE ctsreports.cap_hierarchy
--SET customer_name = p_cust_name,
-- customer_number = p_cust_nbr
-- WHERE customer_id = p_customer_id;
END SURESH_T_AGING_CUSTINFO;

S-ar putea să vă placă și