[Home] [Help]
PACKAGE BODY: APPS.EDW_TRD_PARTNER_PKG
Source
1 Package Body EDW_TRD_PARTNER_PKG AS
2 /* $Header: poafktpb.pls 120.1 2005/06/13 12:51:45 sriswami noship $ */
3
4
5 Function supplier_site_fk(p_vendor_site_id in NUMBER,
6 p_org_id in NUMBER,
7 p_instance_code in VARCHAR2 := NULL) return VARCHAR2 IS
8
9 l_tp VARCHAR2(120) := 'NA_EDW';
10 l_instance VARCHAR2(30) := NULL;
11
12 BEGIN
13
14 IF(p_vendor_site_id is NULL) then
15 return 'NA_EDW';
16 END IF;
17
18 IF (p_instance_code is NOT NULL) then
19 l_instance := p_instance_code;
20 ELSE
21 select instance_code into l_instance
22 from edw_local_instance;
23 END IF;
24
25 l_tp := p_vendor_site_id || '-' || p_org_id
26 || '-' || l_instance
27 || '-' || 'SUPPLIER_SITE';
28
29 return l_tp;
30
31 EXCEPTION
32 when others then
33
34 return 'NA_EDW';
35
36 END supplier_site_fk;
37
38
39 Function supplier_fk(p_vendor_id in NUMBER,
40 p_instance_code in VARCHAR2 := NULL) return VARCHAR2 IS
41 l_tp VARCHAR2(120) := 'NA_EDW';
42 l_instance VARCHAR2(30) := NULL;
43
44 BEGIN
45
46 IF(p_vendor_id is NULL) then
47 return 'NA_EDW';
48 END IF;
49
50 IF (p_instance_code is NOT NULL) then
51 l_instance := p_instance_code;
52 ELSE
53 select instance_code into l_instance
54 from edw_local_instance;
55 END IF;
56
57 l_tp := p_vendor_id || '-' || l_instance
58 || '-' || 'SUPPLIER' || '-' || 'TPRT';
59
60 return l_tp;
61
62 EXCEPTION when others then
63
64 return 'NA_EDW';
65
66 END supplier_fk;
67
68
69 Function customer_fk (p_cust_account_id in NUMBER,
70 p_instance_code in VARCHAR2 := NULL) return VARCHAR2 IS
71 l_tp VARCHAR2(120) := 'NA_EDW';
72 l_instance VARCHAR2(30) := NULL;
73
74 BEGIN
75
76 IF(p_cust_account_id is NULL) then
77 return 'NA_EDW';
78 END IF;
79
80 IF (p_instance_code is NOT NULL) then
81 l_instance := p_instance_code;
82 ELSE
83 select instance_code into l_instance
84 from edw_local_instance;
85 END IF;
86
87 l_tp := p_cust_account_id || '-' || l_instance
88 || '-' || 'CUST_ACCT' || '-' || 'TPRT';
89
90 return l_tp;
91
92 EXCEPTION when others then
93
94 return 'NA_EDW';
95
96 END customer_fk;
97
98
99 Function customer_site_fk (p_site_use_id in NUMBER,
100 p_instance_code in VARCHAR2 := NULL) return VARCHAR2 IS
101 l_tp VARCHAR2(120) := 'NA_EDW';
102 l_instance VARCHAR2(30) := NULL;
103
104 BEGIN
105
106 IF(p_site_use_id is NULL) then
107 return 'NA_EDW';
108 END IF;
109
110 IF (p_instance_code is NOT NULL) then
111 l_instance := p_instance_code;
112 ELSE
113 select instance_code into l_instance
114 from edw_local_instance;
115 END IF;
116
117 l_tp := p_site_use_id || '-' || l_instance || '-' || 'CUST_SITE_USE';
118
119 return l_tp;
120
121 EXCEPTION when others then
122
123 return 'NA_EDW';
124 END customer_site_fk;
125
126
127 Function party_fk (p_party_id in NUMBER,
128 p_instance_code in VARCHAR2 := NULL) return VARCHAR2 IS
129 l_tp VARCHAR2(120) := 'NA_EDW';
130 l_instance VARCHAR2(30) := NULL;
131
132 BEGIN
133
134 IF(p_party_id is NULL) then
135 return 'NA_EDW';
136 END IF;
137
138 IF (p_instance_code is NOT NULL) then
139 l_instance := p_instance_code;
140 ELSE
141 select instance_code into l_instance
142 from edw_local_instance;
143 END IF;
144
145 l_tp := p_party_id || '-' || l_instance || '-' || 'PARTY' || '-' || 'TPRT';
146
147 return l_tp;
148
149 EXCEPTION when others then
150
151 return 'NA_EDW';
152 END party_fk;
153
154 End EDW_TRD_PARTNER_PKG;