DBA Data[Home] [Help]

PACKAGE BODY: APPS.OKL_CONTRACT_PARTY_PUB

Source


1 PACKAGE BODY OKL_CONTRACT_PARTY_PUB AS
2 /* $Header: OKLPCPCB.pls 115.5 2002/03/21 18:03:32 pkm ship       $ */
3   G_APP_NAME			CONSTANT VARCHAR2(3)   :=  OKC_API.G_APP_NAME;
4   G_PKG_NAME			CONSTANT VARCHAR2(200) := 'OKL_CONTRACT_PARTY_PUB';
5 -- Start of comments
6 --
7 -- Procedure Name  : create_contact
8 -- Description     :
9 -- Business Rules  :
10 -- Parameters      :
11 -- Version         : 1.0
12 -- End of comments
13 procedure create_contact(p_api_version	IN	NUMBER,
14                          p_init_msg_list	IN	VARCHAR2 default OKC_API.G_FALSE,
15                          x_return_status	OUT NOCOPY	VARCHAR2,
16                          x_msg_count	OUT NOCOPY	NUMBER,
17                          x_msg_data	OUT NOCOPY	VARCHAR2,
18                          p_ctcv_rec	IN	ctcv_rec_type,
19                          x_ctcv_rec	OUT NOCOPY	ctcv_rec_type) is
20 l_api_name  CONSTANT VARCHAR2(30) := 'create_contact';
21 l_api_version  CONSTANT NUMBER := 1;
22 l_return_status  VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
23 begin
24   l_return_status := OKC_API.START_ACTIVITY(substr(l_api_name,1,26),
25                                               G_PKG_NAME,
26                                               p_init_msg_list,
27                                               l_api_version,
28                                               p_api_version,
29                                               '_PUB',
30                                               x_return_status);
31   IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
32     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
33   ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
34     RAISE OKC_API.G_EXCEPTION_ERROR;
35   END IF;
36   --
37   -- Call Before Logic Hook
38   --
39   g_ctcv_rec := p_ctcv_rec;
40   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'B');
41   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
42     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
43   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
44     raise OKC_API.G_EXCEPTION_ERROR;
45   END IF;
46   OKL_CONTRACT_PARTY_PVT.create_contact(p_api_version,
47                               p_init_msg_list,
48                               x_return_status,
49                               x_msg_count,
50                               x_msg_data,
51                               g_ctcv_rec,
52                               x_ctcv_rec);
53   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
54     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
55   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
56     RAISE OKC_API.G_EXCEPTION_ERROR;
57   END IF;
58   --
59   -- Call After Logic Hook
60   --
61   g_ctcv_rec := x_ctcv_rec;
62   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'A');
63   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
64     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
65   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
66     raise OKC_API.G_EXCEPTION_ERROR;
67   END IF;
68   OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
69   EXCEPTION
70      WHEN OKC_API.G_EXCEPTION_ERROR THEN
71        x_return_status := OKC_API.HANDLE_EXCEPTIONS
72        (substr(l_api_name,1,26),
73         G_PKG_NAME,
74         'OKC_API.G_RET_STS_ERROR',
75         x_msg_count,
76         x_msg_data,
77         '_PUB');
78      WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
79        x_return_status := OKC_API.HANDLE_EXCEPTIONS
80        (substr(l_api_name,1,26),
81         G_PKG_NAME,
82         'OKC_API.G_RET_STS_UNEXP_ERROR',
83         x_msg_count,
84         x_msg_data,
85         '_PUB');
86      WHEN OTHERS THEN
87        x_return_status := OKC_API.HANDLE_EXCEPTIONS
88        (substr(l_api_name,1,26),
89         G_PKG_NAME,
90         'OTHERS',
91         x_msg_count,
92         x_msg_data,
93         '_PUB');
94 end create_contact;
95 -- Start of comments
96 --
97 -- Procedure Name  : create_contact
98 -- Description     :
99 -- Business Rules  :
100 -- Parameters      :
101 -- Version         : 1.0
102 -- End of comments
103 procedure create_contact(p_api_version	IN	NUMBER,
104                               p_init_msg_list	IN	VARCHAR2 default OKC_API.G_FALSE,
105                               x_return_status	OUT NOCOPY	VARCHAR2,
106                               x_msg_count	OUT NOCOPY	NUMBER,
107                               x_msg_data	OUT NOCOPY	VARCHAR2,
108                               p_ctcv_tbl	IN	ctcv_tbl_type,
109                               x_ctcv_tbl	OUT NOCOPY	ctcv_tbl_type) is
110 i NUMBER;
111 l_return_status	VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
112 begin
113      OKC_API.init_msg_list(p_init_msg_list);
114       x_return_status:= OKC_API.G_RET_STS_SUCCESS;
115       if (p_ctcv_tbl.COUNT>0) then
116         i := p_ctcv_tbl.FIRST;
117         LOOP
118 	    create_contact(p_api_version=>p_api_version,
119                               p_init_msg_list=>OKC_API.G_FALSE,
120                               x_return_status=>l_return_status,
121                               x_msg_count=>x_msg_count,
122                               x_msg_data=>x_msg_data,
123                               p_ctcv_rec=>p_ctcv_tbl(i),
124                               x_ctcv_rec=>x_ctcv_tbl(i));
125           if (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
126             x_return_status := l_return_status;
127             raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
128           elsif (l_return_status = OKC_API.G_RET_STS_ERROR) then
129             x_return_status := l_return_status;
130           end if;
131           EXIT WHEN (i=p_ctcv_tbl.LAST);
132           i := p_ctcv_tbl.NEXT(i);
133         END LOOP;
134       end if;
135 exception
136 when others then NULL;
137 end create_contact;
138 -- Start of comments
139 --
140 -- Procedure Name  : update_contact
141 -- Description     :
142 -- Business Rules  :
143 -- Parameters      :
144 -- Version         : 1.0
145 -- End of comments
146 procedure update_contact(p_api_version	IN	NUMBER,
147                               p_init_msg_list	IN	VARCHAR2 default OKC_API.G_FALSE,
148                               x_return_status	OUT NOCOPY	VARCHAR2,
149                               x_msg_count	OUT NOCOPY	NUMBER,
150                               x_msg_data	OUT NOCOPY	VARCHAR2,
151                               p_ctcv_rec	IN	ctcv_rec_type,
152                               x_ctcv_rec	OUT NOCOPY	ctcv_rec_type) is
153 l_api_name                     CONSTANT VARCHAR2(30) := 'update_contact';
154 l_api_version                  CONSTANT NUMBER := 1;
155 l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
156 begin
157   l_return_status := OKC_API.START_ACTIVITY(substr(l_api_name,1,26),
158                                               G_PKG_NAME,
159                                               p_init_msg_list,
160                                               l_api_version,
161                                               p_api_version,
162                                               '_PUB',
163                                               x_return_status);
164   IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
165     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
166   ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
167     RAISE OKC_API.G_EXCEPTION_ERROR;
168   END IF;
169   --
170   -- Call Before Logic Hook
171   --
172   g_ctcv_rec := p_ctcv_rec;
173   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'B');
174   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
175     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
176   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
177     raise OKC_API.G_EXCEPTION_ERROR;
178   END IF;
179   OKL_CONTRACT_PARTY_PVT.update_contact(p_api_version,
180                               p_init_msg_list,
181                               x_return_status,
182                               x_msg_count,
183                               x_msg_data,
184                               g_ctcv_rec,
185                               x_ctcv_rec);
186   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
187     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
188   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
189     RAISE OKC_API.G_EXCEPTION_ERROR;
190   END IF;
191   --
192   -- Call After Logic Hook
193   --
194   g_ctcv_rec := x_ctcv_rec;
195   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'A');
196   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
197     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
198   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
199     raise OKC_API.G_EXCEPTION_ERROR;
200   END IF;
201   OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
202   EXCEPTION
203      WHEN OKC_API.G_EXCEPTION_ERROR THEN
204        x_return_status := OKC_API.HANDLE_EXCEPTIONS
205        (substr(l_api_name,1,26),
206         G_PKG_NAME,
207         'OKC_API.G_RET_STS_ERROR',
208         x_msg_count,
209         x_msg_data,
210         '_PUB');
211      WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
212        x_return_status := OKC_API.HANDLE_EXCEPTIONS
213        (substr(l_api_name,1,26),
214         G_PKG_NAME,
215         'OKC_API.G_RET_STS_UNEXP_ERROR',
216         x_msg_count,
217         x_msg_data,
218         '_PUB');
219      WHEN OTHERS THEN
220        x_return_status := OKC_API.HANDLE_EXCEPTIONS
221        (substr(l_api_name,1,26),
222         G_PKG_NAME,
223         'OTHERS',
224         x_msg_count,
225         x_msg_data,
226         '_PUB');
227 end update_contact;
228 -- Start of comments
229 --
230 -- Procedure Name  : update_contact
231 -- Description     :
232 -- Business Rules  :
233 -- Parameters      :
234 -- Version         : 1.0
235 -- End of comments
236 procedure update_contact(p_api_version	IN	NUMBER,
237                               p_init_msg_list	IN	VARCHAR2 default OKC_API.G_FALSE,
238                               x_return_status	OUT NOCOPY	VARCHAR2,
239                               x_msg_count	OUT NOCOPY	NUMBER,
240                               x_msg_data	OUT NOCOPY	VARCHAR2,
241                               p_ctcv_tbl	IN	ctcv_tbl_type,
242                               x_ctcv_tbl	OUT NOCOPY	ctcv_tbl_type) is
243 i NUMBER;
244 l_return_status	VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
245 begin
246      OKC_API.init_msg_list(p_init_msg_list);
247       x_return_status:= OKC_API.G_RET_STS_SUCCESS;
248       if (p_ctcv_tbl.COUNT>0) then
249         i := p_ctcv_tbl.FIRST;
250         LOOP
251 	    update_contact(p_api_version=>p_api_version,
252                               p_init_msg_list=>OKC_API.G_FALSE,
253                               x_return_status=>l_return_status,
254                               x_msg_count=>x_msg_count,
255                               x_msg_data=>x_msg_data,
256                               p_ctcv_rec=>p_ctcv_tbl(i),
257                               x_ctcv_rec=>x_ctcv_tbl(i));
258           if (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
259             x_return_status := l_return_status;
260             raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
261           elsif (l_return_status = OKC_API.G_RET_STS_ERROR) then
262             x_return_status := l_return_status;
263           end if;
264           EXIT WHEN (i=p_ctcv_tbl.LAST);
265           i := p_ctcv_tbl.NEXT(i);
266         END LOOP;
267       end if;
268 exception
269 when others then NULL;
270 end update_contact;
271 -- Start of comments
272 --
273 -- Procedure Name  : delete_contact
274 -- Description     :
275 -- Business Rules  :
276 -- Parameters      :
277 -- Version         : 1.0
278 -- End of comments
279 procedure delete_contact(p_api_version	IN	NUMBER,
280                               p_init_msg_list	IN	VARCHAR2 default OKC_API.G_FALSE,
281                               x_return_status	OUT NOCOPY	VARCHAR2,
282                               x_msg_count	OUT NOCOPY	NUMBER,
283                               x_msg_data	OUT NOCOPY	VARCHAR2,
284                               p_ctcv_rec	IN	ctcv_rec_type) is
285 l_api_name                     CONSTANT VARCHAR2(30) := 'delete_contact';
286 l_api_version                  CONSTANT NUMBER := 1;
287 l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
288 begin
289   l_return_status := OKC_API.START_ACTIVITY(substr(l_api_name,1,26),
290                                               G_PKG_NAME,
291                                               p_init_msg_list,
292                                               l_api_version,
293                                               p_api_version,
294                                               '_PUB',
295                                               x_return_status);
296   IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
297     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
298   ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
299     RAISE OKC_API.G_EXCEPTION_ERROR;
300   END IF;
301   --
302   -- Call Before Logic Hook
303   --
304   g_ctcv_rec := p_ctcv_rec;
305   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'B');
306   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
307     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
308   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
309     raise OKC_API.G_EXCEPTION_ERROR;
310   END IF;
311   OKL_CONTRACT_PARTY_PVT.delete_contact(p_api_version,
312                               p_init_msg_list,
313                               x_return_status,
314                               x_msg_count,
315                               x_msg_data,
316                               g_ctcv_rec);
317   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
318     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
319   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
320     RAISE OKC_API.G_EXCEPTION_ERROR;
321   END IF;
322   --
323   -- Call After Logic Hook
324   --
325   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'A');
326   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
327     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
328   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
329     raise OKC_API.G_EXCEPTION_ERROR;
330   END IF;
331   OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
332   EXCEPTION
333      WHEN OKC_API.G_EXCEPTION_ERROR THEN
334        x_return_status := OKC_API.HANDLE_EXCEPTIONS
335        (substr(l_api_name,1,26),
336         G_PKG_NAME,
337         'OKC_API.G_RET_STS_ERROR',
338         x_msg_count,
339         x_msg_data,
340         '_PUB');
341      WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
342        x_return_status := OKC_API.HANDLE_EXCEPTIONS
343        (substr(l_api_name,1,26),
344         G_PKG_NAME,
345         'OKC_API.G_RET_STS_UNEXP_ERROR',
346         x_msg_count,
347         x_msg_data,
348         '_PUB');
349      WHEN OTHERS THEN
350        x_return_status := OKC_API.HANDLE_EXCEPTIONS
351        (substr(l_api_name,1,26),
352         G_PKG_NAME,
353         'OTHERS',
354         x_msg_count,
355         x_msg_data,
356         '_PUB');
357 end delete_contact;
358 -- Start of comments
359 --
360 -- Procedure Name  : delete_contact
361 -- Description     :
362 -- Business Rules  :
363 -- Parameters      :
364 -- Version         : 1.0
365 -- End of comments
366 procedure delete_contact(p_api_version	IN	NUMBER,
367                               p_init_msg_list	IN	VARCHAR2 default OKC_API.G_FALSE,
368                               x_return_status	OUT NOCOPY	VARCHAR2,
369                               x_msg_count	OUT NOCOPY	NUMBER,
370                               x_msg_data	OUT NOCOPY	VARCHAR2,
371                               p_ctcv_tbl	IN	ctcv_tbl_type) is
372 i NUMBER;
373 l_return_status	VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
374 begin
375      OKC_API.init_msg_list(p_init_msg_list);
376       x_return_status:= OKC_API.G_RET_STS_SUCCESS;
377       if (p_ctcv_tbl.COUNT>0) then
378         i := p_ctcv_tbl.FIRST;
379         LOOP
380 	    delete_contact(p_api_version=>p_api_version,
381                               p_init_msg_list=>OKC_API.G_FALSE,
382                               x_return_status=>l_return_status,
383                               x_msg_count=>x_msg_count,
384                               x_msg_data=>x_msg_data,
385                               p_ctcv_rec=>p_ctcv_tbl(i));
386           if (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
387             x_return_status := l_return_status;
388             raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
389           elsif (l_return_status = OKC_API.G_RET_STS_ERROR) then
390             x_return_status := l_return_status;
391           end if;
392           EXIT WHEN (i=p_ctcv_tbl.LAST);
393           i := p_ctcv_tbl.NEXT(i);
394         END LOOP;
395       end if;
396 exception
397 when others then NULL;
398 end delete_contact;
399 
400 -- Start of comments
401 --
402 -- Procedure Name  : create_k_party_role
403 -- Description     :
404 -- Business Rules  :
405 -- Parameters      :
406 -- Version         : 1.0
407 -- End of comments
408 procedure create_k_party_role(p_api_version	IN	NUMBER,
409                               p_init_msg_list	IN	VARCHAR2 default OKC_API.G_FALSE,
410                               x_return_status	OUT NOCOPY	VARCHAR2,
411                               x_msg_count	OUT NOCOPY	NUMBER,
412                               x_msg_data	OUT NOCOPY	VARCHAR2,
413                               p_cplv_rec	IN	cplv_rec_type,
414                               x_cplv_rec	OUT NOCOPY	cplv_rec_type) is
415 l_api_name                     CONSTANT VARCHAR2(30) := 'create_k_party_role';
416 l_api_version                  CONSTANT NUMBER := 1;
417 l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
418 begin
419   l_return_status := OKC_API.START_ACTIVITY(substr(l_api_name,1,26),
420                                               G_PKG_NAME,
421                                               p_init_msg_list,
422                                               l_api_version,
423                                               p_api_version,
424                                               '_PUB',
425                                               x_return_status);
426   IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
427     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
428   ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
429     RAISE OKC_API.G_EXCEPTION_ERROR;
430   END IF;
431 
432   --
433   -- Call Before Logic Hook
434   --
435   g_cplv_rec := p_cplv_rec;
436   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'B');
437   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
438     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
439   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
440     raise OKC_API.G_EXCEPTION_ERROR;
441   END IF;
442   OKL_CONTRACT_PARTY_PVT.create_k_party_role(p_api_version,
443                               p_init_msg_list,
444                               x_return_status,
445                               x_msg_count,
446                               x_msg_data,
447                               g_cplv_rec,
448                               x_cplv_rec);
449   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
450     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
451   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
452     RAISE OKC_API.G_EXCEPTION_ERROR;
453   END IF;
454   --
455   -- Call After Logic Hook
456   --
457   g_cplv_rec := x_cplv_rec;
458   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'A');
459   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
460     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
461   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
462     raise OKC_API.G_EXCEPTION_ERROR;
463   END IF;
464   OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
465   EXCEPTION
466      WHEN OKC_API.G_EXCEPTION_ERROR THEN
467        x_return_status := OKC_API.HANDLE_EXCEPTIONS
468        (substr(l_api_name,1,26),
469         G_PKG_NAME,
470         'OKC_API.G_RET_STS_ERROR',
471         x_msg_count,
472         x_msg_data,
473         '_PUB');
474      WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
475        x_return_status := OKC_API.HANDLE_EXCEPTIONS
476        (substr(l_api_name,1,26),
477         G_PKG_NAME,
478         'OKC_API.G_RET_STS_UNEXP_ERROR',
479         x_msg_count,
480         x_msg_data,
481         '_PUB');
482      WHEN OTHERS THEN
483        x_return_status := OKC_API.HANDLE_EXCEPTIONS
484        (substr(l_api_name,1,26),
485         G_PKG_NAME,
486         'OTHERS',
487         x_msg_count,
488         x_msg_data,
489         '_PUB');
490 end create_k_party_role;
491 -- Start of comments
492 --
493 -- Procedure Name  : create_k_party_role
494 -- Description     :
495 -- Business Rules  :
496 -- Parameters      :
497 -- Version         : 1.0
498 -- End of comments
499 procedure create_k_party_role(p_api_version	IN	NUMBER,
500                               p_init_msg_list	IN	VARCHAR2 default OKC_API.G_FALSE,
501                               x_return_status	OUT NOCOPY	VARCHAR2,
502                               x_msg_count	OUT NOCOPY	NUMBER,
503                               x_msg_data	OUT NOCOPY	VARCHAR2,
504                               p_cplv_tbl	IN	cplv_tbl_type,
505                               x_cplv_tbl	OUT NOCOPY	cplv_tbl_type) is
506 i NUMBER;
507 l_return_status	VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
508 begin
509      OKC_API.init_msg_list(p_init_msg_list);
510       x_return_status:= OKC_API.G_RET_STS_SUCCESS;
511       if (p_cplv_tbl.COUNT>0) then
512         i := p_cplv_tbl.FIRST;
513         LOOP
514 	    create_k_party_role(p_api_version=>p_api_version,
515                               p_init_msg_list=>OKC_API.G_FALSE,
516                               x_return_status=>l_return_status,
517                               x_msg_count=>x_msg_count,
518                               x_msg_data=>x_msg_data,
519                               p_cplv_rec=>p_cplv_tbl(i),
520                               x_cplv_rec=>x_cplv_tbl(i));
521           if (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
522             x_return_status := l_return_status;
523             raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
524           elsif (l_return_status = OKC_API.G_RET_STS_ERROR) then
525             x_return_status := l_return_status;
526           end if;
527           EXIT WHEN (i=p_cplv_tbl.LAST);
528           i := p_cplv_tbl.NEXT(i);
529         END LOOP;
530       end if;
531 exception
532 when others then NULL;
533 end create_k_party_role;
534 -- Start of comments
535 --
536 -- Procedure Name  : update_k_party_role
537 -- Description     :
538 -- Business Rules  :
539 -- Parameters      :
540 -- Version         : 1.0
541 -- End of comments
542 procedure update_k_party_role(p_api_version	IN	NUMBER,
543                               p_init_msg_list	IN	VARCHAR2 default OKC_API.G_FALSE,
544                               x_return_status	OUT NOCOPY	VARCHAR2,
545                               x_msg_count	OUT NOCOPY	NUMBER,
546                               x_msg_data	OUT NOCOPY	VARCHAR2,
547                               p_cplv_rec	IN	cplv_rec_type,
548                               x_cplv_rec	OUT NOCOPY	cplv_rec_type) is
549 l_api_name                     CONSTANT VARCHAR2(30) := 'update_k_party_role';
550 l_api_version                  CONSTANT NUMBER := 1;
551 l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
552 begin
553   l_return_status := OKC_API.START_ACTIVITY(substr(l_api_name,1,26),
554                                               G_PKG_NAME,
555                                               p_init_msg_list,
556                                               l_api_version,
557                                               p_api_version,
558                                               '_PUB',
559                                               x_return_status);
560   IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
561     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
562   ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
563     RAISE OKC_API.G_EXCEPTION_ERROR;
564   END IF;
565   --
566   -- Call Before Logic Hook
567   --
568   g_cplv_rec := p_cplv_rec;
569   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'B');
570   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
571     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
572   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
573     raise OKC_API.G_EXCEPTION_ERROR;
574   END IF;
575   OKL_CONTRACT_PARTY_PVT.update_k_party_role(p_api_version,
576                               p_init_msg_list,
577                               x_return_status,
578                               x_msg_count,
579                               x_msg_data,
580                               g_cplv_rec,
581                               x_cplv_rec);
582   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
583     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
584   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
585     RAISE OKC_API.G_EXCEPTION_ERROR;
586   END IF;
587   --
588   -- Call After Logic Hook
589   --
590   g_cplv_rec := x_cplv_rec;
591   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'A');
592   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
593     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
594   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
595     raise OKC_API.G_EXCEPTION_ERROR;
596   END IF;
597   OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
598   EXCEPTION
599      WHEN OKC_API.G_EXCEPTION_ERROR THEN
600        x_return_status := OKC_API.HANDLE_EXCEPTIONS
601        (substr(l_api_name,1,26),
602         G_PKG_NAME,
603         'OKC_API.G_RET_STS_ERROR',
604         x_msg_count,
605         x_msg_data,
606         '_PUB');
607      WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
608        x_return_status := OKC_API.HANDLE_EXCEPTIONS
609        (substr(l_api_name,1,26),
610         G_PKG_NAME,
611         'OKC_API.G_RET_STS_UNEXP_ERROR',
612         x_msg_count,
613         x_msg_data,
614         '_PUB');
615      WHEN OTHERS THEN
616        x_return_status := OKC_API.HANDLE_EXCEPTIONS
617        (substr(l_api_name,1,26),
618         G_PKG_NAME,
619         'OTHERS',
620         x_msg_count,
621         x_msg_data,
622         '_PUB');
623 end update_k_party_role;
624 -- Start of comments
625 --
626 -- Procedure Name  : update_k_party_role
627 -- Description     :
628 -- Business Rules  :
629 -- Parameters      :
630 -- Version         : 1.0
631 -- End of comments
632 procedure update_k_party_role(p_api_version	IN	NUMBER,
633                               p_init_msg_list	IN	VARCHAR2 default OKC_API.G_FALSE,
634                               x_return_status	OUT NOCOPY	VARCHAR2,
635                               x_msg_count	OUT NOCOPY	NUMBER,
636                               x_msg_data	OUT NOCOPY	VARCHAR2,
637                               p_cplv_tbl	IN	cplv_tbl_type,
638                               x_cplv_tbl	OUT NOCOPY	cplv_tbl_type) is
639 i NUMBER;
640 l_return_status	VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
641 begin
642      OKC_API.init_msg_list(p_init_msg_list);
643       x_return_status:= OKC_API.G_RET_STS_SUCCESS;
644       if (p_cplv_tbl.COUNT>0) then
645         i := p_cplv_tbl.FIRST;
646         LOOP
647 	    update_k_party_role(p_api_version=>p_api_version,
648                               p_init_msg_list=>OKC_API.G_FALSE,
649                               x_return_status=>l_return_status,
650                               x_msg_count=>x_msg_count,
651                               x_msg_data=>x_msg_data,
652                               p_cplv_rec=>p_cplv_tbl(i),
653                               x_cplv_rec=>x_cplv_tbl(i));
654           if (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
655             x_return_status := l_return_status;
656             raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
657           elsif (l_return_status = OKC_API.G_RET_STS_ERROR) then
658             x_return_status := l_return_status;
659           end if;
660           EXIT WHEN (i=p_cplv_tbl.LAST);
661           i := p_cplv_tbl.NEXT(i);
662         END LOOP;
663       end if;
664 exception
665 when others then NULL;
666 end update_k_party_role;
667 -- Start of comments
668 --
669 -- Procedure Name  : delete_k_party_role
670 -- Description     :
671 -- Business Rules  :
672 -- Parameters      :
673 -- Version         : 1.0
674 -- End of comments
675 procedure delete_k_party_role(p_api_version	IN	NUMBER,
676                               p_init_msg_list	IN	VARCHAR2 default OKC_API.G_FALSE,
677                               x_return_status	OUT NOCOPY	VARCHAR2,
678                               x_msg_count	OUT NOCOPY	NUMBER,
679                               x_msg_data	OUT NOCOPY	VARCHAR2,
680                               p_cplv_rec	IN	cplv_rec_type) is
681 l_api_name                     CONSTANT VARCHAR2(30) := 'delete_k_party_role';
682 l_api_version                  CONSTANT NUMBER := 1;
683 l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
684 begin
685   l_return_status := OKC_API.START_ACTIVITY(substr(l_api_name,1,26),
686                                               G_PKG_NAME,
687                                               p_init_msg_list,
688                                               l_api_version,
689                                               p_api_version,
690                                               '_PUB',
691                                               x_return_status);
692   IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
693     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
694   ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
695     RAISE OKC_API.G_EXCEPTION_ERROR;
696   END IF;
697   --
698   -- Call Before Logic Hook
699   --
700   g_cplv_rec := p_cplv_rec;
701   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'B');
702   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
703     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
704   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
705     raise OKC_API.G_EXCEPTION_ERROR;
706   END IF;
707   OKL_CONTRACT_PARTY_PVT.delete_k_party_role(p_api_version,
708                               p_init_msg_list,
709                               x_return_status,
710                               x_msg_count,
711                               x_msg_data,
712                               g_cplv_rec);
713   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
714     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
715   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
716     RAISE OKC_API.G_EXCEPTION_ERROR;
717   END IF;
718   --
719   -- Call After Logic Hook
720   --
721   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'A');
722   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
723     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
724   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
725     raise OKC_API.G_EXCEPTION_ERROR;
726   END IF;
727   OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
728   EXCEPTION
729      WHEN OKC_API.G_EXCEPTION_ERROR THEN
730        x_return_status := OKC_API.HANDLE_EXCEPTIONS
731        (substr(l_api_name,1,26),
732         G_PKG_NAME,
733         'OKC_API.G_RET_STS_ERROR',
734         x_msg_count,
735         x_msg_data,
736         '_PUB');
737      WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
738        x_return_status := OKC_API.HANDLE_EXCEPTIONS
739        (substr(l_api_name,1,26),
740         G_PKG_NAME,
741         'OKC_API.G_RET_STS_UNEXP_ERROR',
742         x_msg_count,
743         x_msg_data,
744         '_PUB');
745      WHEN OTHERS THEN
746        x_return_status := OKC_API.HANDLE_EXCEPTIONS
747        (substr(l_api_name,1,26),
748         G_PKG_NAME,
749         'OTHERS',
750         x_msg_count,
751         x_msg_data,
752         '_PUB');
753 end delete_k_party_role;
754 -- Start of comments
755 --
756 -- Procedure Name  : delete_k_party_role
757 -- Description     :
758 -- Business Rules  :
759 -- Parameters      :
760 -- Version         : 1.0
761 -- End of comments
762 procedure delete_k_party_role(p_api_version	IN	NUMBER,
763                               p_init_msg_list	IN	VARCHAR2 default OKC_API.G_FALSE,
764                               x_return_status	OUT NOCOPY	VARCHAR2,
765                               x_msg_count	OUT NOCOPY	NUMBER,
766                               x_msg_data	OUT NOCOPY	VARCHAR2,
767                               p_cplv_tbl	IN	cplv_tbl_type) is
768 i NUMBER;
769 l_return_status	VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
770 begin
771      OKC_API.init_msg_list(p_init_msg_list);
772       x_return_status:= OKC_API.G_RET_STS_SUCCESS;
773       if (p_cplv_tbl.COUNT>0) then
774         i := p_cplv_tbl.FIRST;
775         LOOP
776 	    delete_k_party_role(p_api_version=>p_api_version,
777                               p_init_msg_list=>OKC_API.G_FALSE,
778                               x_return_status=>l_return_status,
779                               x_msg_count=>x_msg_count,
780                               x_msg_data=>x_msg_data,
781                               p_cplv_rec=>p_cplv_tbl(i));
782           if (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
783             x_return_status := l_return_status;
784             raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
785           elsif (l_return_status = OKC_API.G_RET_STS_ERROR) then
786             x_return_status := l_return_status;
787           end if;
788           EXIT WHEN (i=p_cplv_tbl.LAST);
789           i := p_cplv_tbl.NEXT(i);
790         END LOOP;
791       end if;
792 exception
793 when others then NULL;
794 end delete_k_party_role;
795 
796 END; -- Package Body OKL_CONTRACT_PARTY_PUB