1 package body ams_importclient_pvt_w as
2 /* $Header: amswmicb.pls 115.9 2003/05/15 22:36:28 huili ship $ */
3 rosetta_g_mistake_date date := to_date('01/01/+4713', 'MM/DD/SYYYY');
4 rosetta_g_miss_date date := to_date('01/01/-4712', 'MM/DD/SYYYY');
5
6 function rosetta_g_miss_num_map(n number) return number as
7 a number := fnd_api.g_miss_num;
8 b number := 0-1962.0724;
9 begin
10 if n=a then return b; end if;
11 if n=b then return a; end if;
12 return n;
13 end;
14
15 -- this is to workaround the JDBC bug regarding IN DATE of value GMiss
16 function rosetta_g_miss_date_in_map(d date) return date as
17 begin
18 if d = rosetta_g_mistake_date then return fnd_api.g_miss_date; end if;
19 return d;
20 end;
21
22 procedure rosetta_table_copy_in_p0(t OUT NOCOPY ams_importclient_pvt.char_data_set_type_w, a0 JTF_VARCHAR2_TABLE_4000) as
23 ddindx binary_integer; indx binary_integer;
24 begin
25 if a0 is not null and a0.count > 0 then
26 if a0.count > 0 then
27 indx := a0.first;
28 ddindx := 1;
29 while true loop
30 t(ddindx) := a0(indx);
31 ddindx := ddindx+1;
32 if a0.last =indx
33 then exit;
34 end if;
35 indx := a0.next(indx);
36 end loop;
37 end if;
38 end if;
39 end rosetta_table_copy_in_p0;
40 procedure rosetta_table_copy_out_p0(t ams_importclient_pvt.char_data_set_type_w, a0 OUT NOCOPY JTF_VARCHAR2_TABLE_4000) as
41 ddindx binary_integer; indx binary_integer;
42 begin
43 if t is null or t.count = 0 then
44 a0 := JTF_VARCHAR2_TABLE_4000();
45 else
46 a0 := JTF_VARCHAR2_TABLE_4000();
47 if t.count > 0 then
48 a0.extend(t.count);
49 ddindx := t.first;
50 indx := 1;
51 while true loop
52 a0(indx) := t(ddindx);
53 indx := indx+1;
54 if t.last =ddindx
55 then exit;
56 end if;
57 ddindx := t.next(ddindx);
58 end loop;
59 end if;
60 end if;
61 end rosetta_table_copy_out_p0;
62
63 procedure rosetta_table_copy_in_p1(t OUT NOCOPY ams_importclient_pvt.num_data_set_type_w, a0 JTF_NUMBER_TABLE) as
64 ddindx binary_integer; indx binary_integer;
65 begin
66 if a0 is not null and a0.count > 0 then
67 if a0.count > 0 then
68 indx := a0.first;
69 ddindx := 1;
70 while true loop
71 t(ddindx) := a0(indx);
72 ddindx := ddindx+1;
73 if a0.last =indx
74 then exit;
75 end if;
76 indx := a0.next(indx);
77 end loop;
78 end if;
79 end if;
80 end rosetta_table_copy_in_p1;
81 procedure rosetta_table_copy_out_p1(t ams_importclient_pvt.num_data_set_type_w, a0 OUT NOCOPY JTF_NUMBER_TABLE) as
82 ddindx binary_integer; indx binary_integer;
83 begin
84 if t is null or t.count = 0 then
85 a0 := JTF_NUMBER_TABLE();
86 else
87 a0 := JTF_NUMBER_TABLE();
88 if t.count > 0 then
89 a0.extend(t.count);
90 ddindx := t.first;
91 indx := 1;
92 while true loop
93 a0(indx) := t(ddindx);
94 indx := indx+1;
95 if t.last =ddindx
96 then exit;
97 end if;
98 ddindx := t.next(ddindx);
99 end loop;
100 end if;
101 end if;
102 end rosetta_table_copy_out_p1;
103
104 procedure rosetta_table_copy_in_p2(t OUT NOCOPY ams_importclient_pvt.varchar2_4000_set_type, a0 JTF_VARCHAR2_TABLE_4000) as
105 ddindx binary_integer; indx binary_integer;
106 begin
107 if a0 is not null and a0.count > 0 then
108 if a0.count > 0 then
109 indx := a0.first;
110 ddindx := 1;
111 while true loop
112 t(ddindx) := a0(indx);
113 ddindx := ddindx+1;
114 if a0.last =indx
115 then exit;
116 end if;
117 indx := a0.next(indx);
118 end loop;
119 end if;
120 end if;
121 end rosetta_table_copy_in_p2;
122 procedure rosetta_table_copy_out_p2(t ams_importclient_pvt.varchar2_4000_set_type, a0 OUT NOCOPY JTF_VARCHAR2_TABLE_4000) as
123 ddindx binary_integer; indx binary_integer;
124 begin
125 if t is null or t.count = 0 then
126 a0 := JTF_VARCHAR2_TABLE_4000();
127 else
128 a0 := JTF_VARCHAR2_TABLE_4000();
129 if t.count > 0 then
130 a0.extend(t.count);
131 ddindx := t.first;
132 indx := 1;
133 while true loop
134 a0(indx) := t(ddindx);
135 indx := indx+1;
136 if t.last =ddindx
137 then exit;
138 end if;
139 ddindx := t.next(ddindx);
140 end loop;
141 end if;
142 end if;
143 end rosetta_table_copy_out_p2;
144
145 procedure rosetta_table_copy_in_p3(t OUT NOCOPY ams_importclient_pvt.varchar2_150_set_type, a0 JTF_VARCHAR2_TABLE_200) as
146 ddindx binary_integer; indx binary_integer;
147 begin
148 if a0 is not null and a0.count > 0 then
149 if a0.count > 0 then
150 indx := a0.first;
151 ddindx := 1;
152 while true loop
153 t(ddindx) := a0(indx);
154 ddindx := ddindx+1;
155 if a0.last =indx
156 then exit;
157 end if;
158 indx := a0.next(indx);
159 end loop;
160 end if;
161 end if;
162 end rosetta_table_copy_in_p3;
163 procedure rosetta_table_copy_out_p3(t ams_importclient_pvt.varchar2_150_set_type, a0 OUT NOCOPY JTF_VARCHAR2_TABLE_200) as
164 ddindx binary_integer; indx binary_integer;
165 begin
166 if t is null or t.count = 0 then
167 a0 := JTF_VARCHAR2_TABLE_200();
168 else
169 a0 := JTF_VARCHAR2_TABLE_200();
170 if t.count > 0 then
171 a0.extend(t.count);
172 ddindx := t.first;
173 indx := 1;
174 while true loop
175 a0(indx) := t(ddindx);
176 indx := indx+1;
177 if t.last =ddindx
178 then exit;
179 end if;
180 ddindx := t.next(ddindx);
181 end loop;
182 end if;
183 end if;
184 end rosetta_table_copy_out_p3;
185
186 procedure insert_lead_data(p_api_version NUMBER
187 , p_init_msg_list VARCHAR2
188 , p_commit VARCHAR2
189 , p_import_list_header_id NUMBER
190 , p_data JTF_VARCHAR2_TABLE_4000
191 , p_error_rows JTF_NUMBER_TABLE
192 , p_row_count NUMBER
193 , x_return_status OUT NOCOPY VARCHAR2
194 , x_msg_count OUT NOCOPY NUMBER
195 , x_msg_data OUT NOCOPY VARCHAR2
196 )
197
198 as
199 ddp_data ams_importclient_pvt.char_data_set_type_w;
200 ddp_error_rows ams_importclient_pvt.num_data_set_type_w;
201 ddindx binary_integer; indx binary_integer;
202 begin
203
204 -- copy data to the local IN or IN-OUT args, if any
205
206
207
208
209 ams_importclient_pvt_w.rosetta_table_copy_in_p0(ddp_data, p_data);
210
211 ams_importclient_pvt_w.rosetta_table_copy_in_p1(ddp_error_rows, p_error_rows);
212
213
214
215
216
217 -- here's the delegated call to the old PL/SQL routine
218 ams_importclient_pvt.insert_lead_data(p_api_version,
219 p_init_msg_list,
220 p_commit,
221 p_import_list_header_id,
222 ddp_data,
223 ddp_error_rows,
224 p_row_count,
225 x_return_status,
226 x_msg_count,
227 x_msg_data);
228
229 -- copy data back from the local variables to OUT or IN-OUT args, if any
230
231
232
233
234
235
236
237
238
239 end;
240
241 procedure insert_list_data(p_api_version NUMBER
242 , p_init_msg_list VARCHAR2
243 , p_commit VARCHAR2
244 , p_import_list_header_id NUMBER
245 , p_data JTF_VARCHAR2_TABLE_4000
246 , p_row_count NUMBER
247 , p_error_rows JTF_NUMBER_TABLE
248 , x_return_status OUT NOCOPY VARCHAR2
249 , x_msg_count OUT NOCOPY NUMBER
250 , x_msg_data OUT NOCOPY VARCHAR2
251 )
252
253 as
254 ddp_data ams_importclient_pvt.char_data_set_type_w;
255 ddp_error_rows ams_importclient_pvt.num_data_set_type_w;
256 ddindx binary_integer; indx binary_integer;
257 begin
258
259 -- copy data to the local IN or IN-OUT args, if any
260
261
262
263
264 ams_importclient_pvt_w.rosetta_table_copy_in_p0(ddp_data, p_data);
265
266
267 ams_importclient_pvt_w.rosetta_table_copy_in_p1(ddp_error_rows, p_error_rows);
268
269
270
271
272 -- here's the delegated call to the old PL/SQL routine
273 ams_importclient_pvt.insert_list_data(p_api_version,
274 p_init_msg_list,
275 p_commit,
276 p_import_list_header_id,
277 ddp_data,
278 p_row_count,
279 ddp_error_rows,
280 x_return_status,
281 x_msg_count,
282 x_msg_data);
283
284 -- copy data back from the local variables to OUT or IN-OUT args, if any
285
286
287
288
289
290
291
292
293
294 end;
295
296 end ams_importclient_pvt_w;