1 PACKAGE BODY JAI_AR_HCA_TRIGGER_PKG AS
2 /* $Header: jai_ar_rc_t.plb 120.0 2005/09/01 12:34:59 rallamse noship $ */
3 /*
4 REM +======================================================================+
5 REM NAME ARD_T1
6 REM
7 REM DESCRIPTION Called from trigger JAI_AR_RC_ARIUD_T1
8 REM
9 REM NOTES Refers to old trigger JAI_AR_RC_ARD_T1
10 REM
11 REM +======================================================================+
12 */
13 PROCEDURE ARD_T1 ( pr_old t_rec%type , pr_new t_rec%type , pv_action varchar2 , pv_return_code out nocopy varchar2 , pv_return_message out nocopy varchar2 ) IS
14 v_count Number;
15 v_customer_id Number; -- := pr_old.customer_id; --Ramananda for File.Sql.35
16
17 Cursor Cust_count IS
18 Select count(*)
19 From JAI_CMN_CUS_ADDRESSES
20 Where Customer_Id = v_customer_id;
21
22 BEGIN
23 pv_return_code := jai_constants.successful ;
24 /* FILENAME: JA_IN_CUSTOMER_DELETE_TRG.sql
25
26 CHANGE HISTORY:
27 S.No Date Author and Details
28 1. 2001/07/12 Anuradha Parthasarathy
29 Code added to ensure that this trigger doesnt fire for Non Indian OU.
30
31 2. 26-05-2005 rallamse bug#4384239
32 The trigger is previously based on AR.RA_CUSTOMERS
33 which does not have a synonym in APPS and GSCC does not allow hardcoded
34 schema name AR as per File.Sql.6
35 As per discussion with CBABU, changed the trigger to table HZ_CUST_ACCOUNTS
36 and used pr_old.cust_account_id instead of pr_old.customer_id
37
38 3. 08-Jun-2005 File Version 116.2. This Object is Modified to refer to New DB Entity names in place of Old
39 DB Entity as required for CASE COMPLAINCE.
40
41 4. 13-Jun-2005 Ramananda for bug#4428980. File Version: 116.2
42 Removal of SQL LITERALs is done
43
44 --------------------------------------------------------------------------------------------*/
45 v_customer_id := pr_old.cust_account_id; --Ramananda for File.Sql.35
46
47 Open Cust_Count;
48 Fetch Cust_Count into v_count;
49 Close Cust_Count;
50
51 If NVL(v_count,0) = 0 then
52 Return;
53 Else
54 Delete JAI_CMN_CUS_ADDRESSES
55 Where Customer_ID = v_customer_id;
56 End if;
57 /* Added an exception block by Ramananda for bug#4570303 */
58 EXCEPTION
59 WHEN OTHERS THEN
60 Pv_return_code := jai_constants.unexpected_error;
61 Pv_return_message := 'Encountered an error in JAI_AR_HCA_TRIGGER_PKG.ARD_T1 ' || substr(sqlerrm,1,1900);
62
63 END ARD_T1 ;
64
65 END JAI_AR_HCA_TRIGGER_PKG ;