DBA Data[Home] [Help]

PACKAGE BODY: APPS.OKC_CONTRACT_PARTY_PUB

Source


1 package body OKC_CONTRACT_PARTY_PUB as
2 /* $Header: OKCPCPLB.pls 120.0 2005/05/26 09:35:19 appldev noship $ */
3 	l_debug VARCHAR2(1) := NVL(FND_PROFILE.VALUE('AFLOG_ENABLED'),'N');
4 
5   G_APP_NAME			CONSTANT VARCHAR2(3)   :=  OKC_API.G_APP_NAME;
6   G_PKG_NAME			CONSTANT VARCHAR2(200) := 'OKC_CONTRACT_PARTY_PUB';
7 
8 procedure reset(p_ctcv_rec IN ctcv_rec_type) is
9 begin
10     g_ctcv_rec.id                    := p_ctcv_rec.id;
11     g_ctcv_rec.object_version_number := p_ctcv_rec.object_version_number;
12     g_ctcv_rec.created_by            := p_ctcv_rec.created_by;
13     g_ctcv_rec.creation_date         := p_ctcv_rec.creation_date;
14     g_ctcv_rec.last_updated_by       := p_ctcv_rec.last_updated_by;
15     g_ctcv_rec.last_update_date      := p_ctcv_rec.last_update_date;
16     g_ctcv_rec.last_update_login     := p_ctcv_rec.last_update_login;
17 end reset;
18 
19 procedure reset(p_cplv_rec IN cplv_rec_type) is
20 begin
21     g_cplv_rec.id                    := p_cplv_rec.id;
22     g_cplv_rec.object_version_number := p_cplv_rec.object_version_number;
23     g_cplv_rec.created_by            := p_cplv_rec.created_by;
24     g_cplv_rec.creation_date         := p_cplv_rec.creation_date;
25     g_cplv_rec.last_updated_by       := p_cplv_rec.last_updated_by;
26     g_cplv_rec.last_update_date      := p_cplv_rec.last_update_date;
27     g_cplv_rec.last_update_login     := p_cplv_rec.last_update_login;
28 end reset;
29 
30 -- Start of comments
31 --
32 -- Procedure Name  : create_contact
33 -- Description     :
34 -- Business Rules  :
35 -- Parameters      :
36 -- Version         : 1.0
37 -- End of comments
38 procedure create_contact(p_api_version	IN	NUMBER,
39                               p_init_msg_list	IN	VARCHAR2 ,
40                               x_return_status	OUT NOCOPY	VARCHAR2,
41                               x_msg_count	OUT NOCOPY	NUMBER,
42                               x_msg_data	OUT NOCOPY	VARCHAR2,
43                               p_ctcv_rec	IN	ctcv_rec_type,
44                               x_ctcv_rec	OUT NOCOPY	ctcv_rec_type) is
45 l_api_name                     CONSTANT VARCHAR2(30) := 'create_contact';
46 l_api_version                  CONSTANT NUMBER := 1;
47 l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
48 begin
49   l_return_status := OKC_API.START_ACTIVITY(substr(l_api_name,1,26),
50                                               G_PKG_NAME,
51                                               p_init_msg_list,
52                                               l_api_version,
53                                               p_api_version,
54                                               '_PUB',
55                                               x_return_status);
56   IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
57     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
58   ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
59     RAISE OKC_API.G_EXCEPTION_ERROR;
60   END IF;
61   --
62   -- Call Before Logic Hook
63   --
64   g_ctcv_rec := p_ctcv_rec;
65   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'B');
66   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
67     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
68   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
69     raise OKC_API.G_EXCEPTION_ERROR;
70   END IF;
71   reset(p_ctcv_rec);
72   OKC_CONTRACT_PARTY_PVT.create_contact(p_api_version,
73                               p_init_msg_list,
74                               x_return_status,
75                               x_msg_count,
76                               x_msg_data,
77                               g_ctcv_rec,
78                               x_ctcv_rec);
79   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
80     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
81   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
82     RAISE OKC_API.G_EXCEPTION_ERROR;
83   END IF;
84   --
85   -- Call After Logic Hook
86   --
87   g_ctcv_rec := x_ctcv_rec;
88   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'A');
89   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
90     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
91   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
92     raise OKC_API.G_EXCEPTION_ERROR;
93   END IF;
94   OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
95   EXCEPTION
96      WHEN OKC_API.G_EXCEPTION_ERROR THEN
97        x_return_status := OKC_API.HANDLE_EXCEPTIONS
98        (substr(l_api_name,1,26),
99         G_PKG_NAME,
100         'OKC_API.G_RET_STS_ERROR',
101         x_msg_count,
102         x_msg_data,
103         '_PUB');
104      WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
105        x_return_status := OKC_API.HANDLE_EXCEPTIONS
106        (substr(l_api_name,1,26),
107         G_PKG_NAME,
108         'OKC_API.G_RET_STS_UNEXP_ERROR',
109         x_msg_count,
110         x_msg_data,
111         '_PUB');
112      WHEN OTHERS THEN
113        x_return_status := OKC_API.HANDLE_EXCEPTIONS
114        (substr(l_api_name,1,26),
115         G_PKG_NAME,
116         'OTHERS',
117         x_msg_count,
118         x_msg_data,
119         '_PUB');
120 end create_contact;
121 
122 -- Start of comments
123 --
124 -- Procedure Name  : create_contact
125 -- Description     :
126 -- Business Rules  :
127 -- Parameters      :
128 -- Version         : 1.0
129 -- End of comments
130 procedure create_contact(p_api_version	IN	NUMBER,
131                               p_init_msg_list	IN	VARCHAR2 ,
132                               x_return_status	OUT NOCOPY	VARCHAR2,
133                               x_msg_count	OUT NOCOPY	NUMBER,
134                               x_msg_data	OUT NOCOPY	VARCHAR2,
135                               p_ctcv_tbl	IN	ctcv_tbl_type,
136                               x_ctcv_tbl	OUT NOCOPY	ctcv_tbl_type) is
137 i NUMBER;
138 l_return_status	VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
139 begin
140      OKC_API.init_msg_list(p_init_msg_list);
141       x_return_status:= OKC_API.G_RET_STS_SUCCESS;
142       if (p_ctcv_tbl.COUNT>0) then
143         i := p_ctcv_tbl.FIRST;
144         LOOP
145 	    create_contact(p_api_version=>p_api_version,
146                               p_init_msg_list=>OKC_API.G_FALSE,
147                               x_return_status=>l_return_status,
148                               x_msg_count=>x_msg_count,
149                               x_msg_data=>x_msg_data,
150                               p_ctcv_rec=>p_ctcv_tbl(i),
151                               x_ctcv_rec=>x_ctcv_tbl(i));
152           if (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
153             x_return_status := l_return_status;
154             raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
155           elsif (l_return_status = OKC_API.G_RET_STS_ERROR) then
156             x_return_status := l_return_status;
157           end if;
158           EXIT WHEN (i=p_ctcv_tbl.LAST);
159           i := p_ctcv_tbl.NEXT(i);
160         END LOOP;
161       end if;
162 exception
163 when others then NULL;
164 end create_contact;
165 
166 -- Start of comments
167 --
168 -- Procedure Name  : update_contact
169 -- Description     :
170 -- Business Rules  :
171 -- Parameters      :
172 -- Version         : 1.0
173 -- End of comments
174 procedure update_contact(p_api_version	IN	NUMBER,
175                               p_init_msg_list	IN	VARCHAR2 ,
176                               x_return_status	OUT NOCOPY	VARCHAR2,
177                               x_msg_count	OUT NOCOPY	NUMBER,
178                               x_msg_data	OUT NOCOPY	VARCHAR2,
179                               p_ctcv_rec	IN	ctcv_rec_type,
180                               x_ctcv_rec	OUT NOCOPY	ctcv_rec_type) is
181 l_api_name                     CONSTANT VARCHAR2(30) := 'update_contact';
182 l_api_version                  CONSTANT NUMBER := 1;
183 l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
184 begin
185   l_return_status := OKC_API.START_ACTIVITY(substr(l_api_name,1,26),
186                                               G_PKG_NAME,
187                                               p_init_msg_list,
188                                               l_api_version,
189                                               p_api_version,
190                                               '_PUB',
191                                               x_return_status);
192   IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
193     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
194   ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
195     RAISE OKC_API.G_EXCEPTION_ERROR;
196   END IF;
197   --
198   -- Call Before Logic Hook
199   --
200   g_ctcv_rec := p_ctcv_rec;
201   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'B');
202   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
203     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
204   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
205     raise OKC_API.G_EXCEPTION_ERROR;
206   END IF;
207   reset(p_ctcv_rec);
208   OKC_CONTRACT_PARTY_PVT.update_contact(p_api_version,
209                               p_init_msg_list,
210                               x_return_status,
211                               x_msg_count,
212                               x_msg_data,
213                               g_ctcv_rec,
214                               x_ctcv_rec);
215   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
216     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
217   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
218     RAISE OKC_API.G_EXCEPTION_ERROR;
219   END IF;
220   --
221   -- Call After Logic Hook
222   --
223   g_ctcv_rec := x_ctcv_rec;
224   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'A');
225   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
226     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
227   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
228     raise OKC_API.G_EXCEPTION_ERROR;
229   END IF;
230   OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
231   EXCEPTION
232      WHEN OKC_API.G_EXCEPTION_ERROR THEN
233        x_return_status := OKC_API.HANDLE_EXCEPTIONS
234        (substr(l_api_name,1,26),
235         G_PKG_NAME,
236         'OKC_API.G_RET_STS_ERROR',
237         x_msg_count,
238         x_msg_data,
239         '_PUB');
240      WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
241        x_return_status := OKC_API.HANDLE_EXCEPTIONS
242        (substr(l_api_name,1,26),
243         G_PKG_NAME,
244         'OKC_API.G_RET_STS_UNEXP_ERROR',
245         x_msg_count,
246         x_msg_data,
247         '_PUB');
248      WHEN OTHERS THEN
249        x_return_status := OKC_API.HANDLE_EXCEPTIONS
250        (substr(l_api_name,1,26),
251         G_PKG_NAME,
252         'OTHERS',
253         x_msg_count,
254         x_msg_data,
255         '_PUB');
256 end update_contact;
257 
258 -- Start of comments
259 --
260 -- Procedure Name  : update_contact
261 -- Description     :
262 -- Business Rules  :
263 -- Parameters      :
264 -- Version         : 1.0
265 -- End of comments
266 procedure update_contact(p_api_version	IN	NUMBER,
267                               p_init_msg_list	IN	VARCHAR2 ,
268                               x_return_status	OUT NOCOPY	VARCHAR2,
269                               x_msg_count	OUT NOCOPY	NUMBER,
270                               x_msg_data	OUT NOCOPY	VARCHAR2,
271                               p_ctcv_tbl	IN	ctcv_tbl_type,
272                               x_ctcv_tbl	OUT NOCOPY	ctcv_tbl_type) is
273 i NUMBER;
274 l_return_status	VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
275 begin
276      OKC_API.init_msg_list(p_init_msg_list);
277       x_return_status:= OKC_API.G_RET_STS_SUCCESS;
278       if (p_ctcv_tbl.COUNT>0) then
279         i := p_ctcv_tbl.FIRST;
280         LOOP
281 	    update_contact(p_api_version=>p_api_version,
282                               p_init_msg_list=>OKC_API.G_FALSE,
283                               x_return_status=>l_return_status,
284                               x_msg_count=>x_msg_count,
285                               x_msg_data=>x_msg_data,
286                               p_ctcv_rec=>p_ctcv_tbl(i),
287                               x_ctcv_rec=>x_ctcv_tbl(i));
288           if (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
289             x_return_status := l_return_status;
290             raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
291           elsif (l_return_status = OKC_API.G_RET_STS_ERROR) then
292             x_return_status := l_return_status;
293           end if;
294           EXIT WHEN (i=p_ctcv_tbl.LAST);
295           i := p_ctcv_tbl.NEXT(i);
296         END LOOP;
297       end if;
298 exception
299 when others then NULL;
300 end update_contact;
301 
302 -- Start of comments
303 --
304 -- Procedure Name  : delete_contact
305 -- Description     :
306 -- Business Rules  :
307 -- Parameters      :
308 -- Version         : 1.0
309 -- End of comments
310 procedure delete_contact(p_api_version	IN	NUMBER,
311                               p_init_msg_list	IN	VARCHAR2 ,
312                               x_return_status	OUT NOCOPY	VARCHAR2,
313                               x_msg_count	OUT NOCOPY	NUMBER,
314                               x_msg_data	OUT NOCOPY	VARCHAR2,
315                               p_ctcv_rec	IN	ctcv_rec_type) is
316 l_api_name                     CONSTANT VARCHAR2(30) := 'delete_contact';
317 l_api_version                  CONSTANT NUMBER := 1;
318 l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
319 begin
320   l_return_status := OKC_API.START_ACTIVITY(substr(l_api_name,1,26),
321                                               G_PKG_NAME,
322                                               p_init_msg_list,
323                                               l_api_version,
324                                               p_api_version,
325                                               '_PUB',
326                                               x_return_status);
327   IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
328     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
329   ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
330     RAISE OKC_API.G_EXCEPTION_ERROR;
331   END IF;
332   --
333   -- Call Before Logic Hook
334   --
335   g_ctcv_rec := p_ctcv_rec;
336   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'B');
337   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
338     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
339   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
340     raise OKC_API.G_EXCEPTION_ERROR;
341   END IF;
342   reset(p_ctcv_rec);
343   OKC_CONTRACT_PARTY_PVT.delete_contact(p_api_version,
344                               p_init_msg_list,
345                               x_return_status,
346                               x_msg_count,
347                               x_msg_data,
348                               g_ctcv_rec);
349   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
350     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
351   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
352     RAISE OKC_API.G_EXCEPTION_ERROR;
353   END IF;
354   --
355   -- Call After Logic Hook
356   --
357   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'A');
358   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
359     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
360   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
361     raise OKC_API.G_EXCEPTION_ERROR;
362   END IF;
363   OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
364   EXCEPTION
365      WHEN OKC_API.G_EXCEPTION_ERROR THEN
366        x_return_status := OKC_API.HANDLE_EXCEPTIONS
367        (substr(l_api_name,1,26),
368         G_PKG_NAME,
369         'OKC_API.G_RET_STS_ERROR',
370         x_msg_count,
371         x_msg_data,
372         '_PUB');
373      WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
374        x_return_status := OKC_API.HANDLE_EXCEPTIONS
375        (substr(l_api_name,1,26),
376         G_PKG_NAME,
377         'OKC_API.G_RET_STS_UNEXP_ERROR',
378         x_msg_count,
379         x_msg_data,
380         '_PUB');
381      WHEN OTHERS THEN
382        x_return_status := OKC_API.HANDLE_EXCEPTIONS
383        (substr(l_api_name,1,26),
384         G_PKG_NAME,
385         'OTHERS',
386         x_msg_count,
387         x_msg_data,
388         '_PUB');
389 end delete_contact;
390 
391 -- Start of comments
392 --
393 -- Procedure Name  : delete_contact
394 -- Description     :
395 -- Business Rules  :
396 -- Parameters      :
397 -- Version         : 1.0
398 -- End of comments
399 procedure delete_contact(p_api_version	IN	NUMBER,
400                               p_init_msg_list	IN	VARCHAR2 ,
401                               x_return_status	OUT NOCOPY	VARCHAR2,
402                               x_msg_count	OUT NOCOPY	NUMBER,
403                               x_msg_data	OUT NOCOPY	VARCHAR2,
404                               p_ctcv_tbl	IN	ctcv_tbl_type) is
405 i NUMBER;
406 l_return_status	VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
407 begin
408      OKC_API.init_msg_list(p_init_msg_list);
409       x_return_status:= OKC_API.G_RET_STS_SUCCESS;
410       if (p_ctcv_tbl.COUNT>0) then
411         i := p_ctcv_tbl.FIRST;
412         LOOP
413 	    delete_contact(p_api_version=>p_api_version,
414                               p_init_msg_list=>OKC_API.G_FALSE,
415                               x_return_status=>l_return_status,
416                               x_msg_count=>x_msg_count,
417                               x_msg_data=>x_msg_data,
418                               p_ctcv_rec=>p_ctcv_tbl(i));
419           if (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
420             x_return_status := l_return_status;
421             raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
422           elsif (l_return_status = OKC_API.G_RET_STS_ERROR) then
423             x_return_status := l_return_status;
424           end if;
425           EXIT WHEN (i=p_ctcv_tbl.LAST);
426           i := p_ctcv_tbl.NEXT(i);
427         END LOOP;
428       end if;
429 exception
430 when others then NULL;
431 end delete_contact;
432 
433 -- Start of comments
434 --
435 -- Procedure Name  : lock_contact
436 -- Description     :
437 -- Business Rules  :
438 -- Parameters      :
439 -- Version         : 1.0
440 -- End of comments
441 procedure lock_contact(p_api_version	IN	NUMBER,
442                               p_init_msg_list	IN	VARCHAR2 ,
443                               x_return_status	OUT NOCOPY	VARCHAR2,
444                               x_msg_count	OUT NOCOPY	NUMBER,
445                               x_msg_data	OUT NOCOPY	VARCHAR2,
446                               p_ctcv_rec	IN	ctcv_rec_type) is
447 l_api_name                     CONSTANT VARCHAR2(30) := 'lock_contact';
448 l_api_version                  CONSTANT NUMBER := 1;
449 l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
450 begin
451   l_return_status := OKC_API.START_ACTIVITY(substr(l_api_name,1,26),
452                                               G_PKG_NAME,
453                                               p_init_msg_list,
454                                               l_api_version,
455                                               p_api_version,
456                                               '_PUB',
457                                               x_return_status);
458   IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
459     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
460   ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
461     RAISE OKC_API.G_EXCEPTION_ERROR;
462   END IF;
463   --
464   -- Call Before Logic Hook
465   --
466   g_ctcv_rec := p_ctcv_rec;
467   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'B');
468   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
469     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
470   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
471     raise OKC_API.G_EXCEPTION_ERROR;
472   END IF;
473   reset(p_ctcv_rec);
474   OKC_CONTRACT_PARTY_PVT.lock_contact(p_api_version,
475                               p_init_msg_list,
476                               x_return_status,
477                               x_msg_count,
478                               x_msg_data,
479                               g_ctcv_rec);
480   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
481     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
482   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
483     RAISE OKC_API.G_EXCEPTION_ERROR;
484   END IF;
485   --
486   -- Call After Logic Hook
487   --
488   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'A');
489   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
490     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
491   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
492     raise OKC_API.G_EXCEPTION_ERROR;
493   END IF;
494   OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
495   EXCEPTION
496      WHEN OKC_API.G_EXCEPTION_ERROR THEN
497        x_return_status := OKC_API.HANDLE_EXCEPTIONS
498        (substr(l_api_name,1,26),
499         G_PKG_NAME,
500         'OKC_API.G_RET_STS_ERROR',
501         x_msg_count,
502         x_msg_data,
503         '_PUB');
504      WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
505        x_return_status := OKC_API.HANDLE_EXCEPTIONS
506        (substr(l_api_name,1,26),
507         G_PKG_NAME,
508         'OKC_API.G_RET_STS_UNEXP_ERROR',
509         x_msg_count,
510         x_msg_data,
511         '_PUB');
512      WHEN OTHERS THEN
513        x_return_status := OKC_API.HANDLE_EXCEPTIONS
514        (substr(l_api_name,1,26),
515         G_PKG_NAME,
516         'OTHERS',
517         x_msg_count,
518         x_msg_data,
519         '_PUB');
520 end lock_contact;
521 
522 -- Start of comments
523 --
524 -- Procedure Name  : lock_contact
525 -- Description     :
526 -- Business Rules  :
527 -- Parameters      :
528 -- Version         : 1.0
529 -- End of comments
530 procedure lock_contact(p_api_version	IN	NUMBER,
531                               p_init_msg_list	IN	VARCHAR2 ,
532                               x_return_status	OUT NOCOPY	VARCHAR2,
533                               x_msg_count	OUT NOCOPY	NUMBER,
534                               x_msg_data	OUT NOCOPY	VARCHAR2,
535                               p_ctcv_tbl	IN	ctcv_tbl_type) is
536 i NUMBER;
537 l_return_status	VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
538 begin
539      OKC_API.init_msg_list(p_init_msg_list);
540       x_return_status:= OKC_API.G_RET_STS_SUCCESS;
541       if (p_ctcv_tbl.COUNT>0) then
542         i := p_ctcv_tbl.FIRST;
543         LOOP
544 	    lock_contact(p_api_version=>p_api_version,
545                               p_init_msg_list=>OKC_API.G_FALSE,
546                               x_return_status=>l_return_status,
547                               x_msg_count=>x_msg_count,
548                               x_msg_data=>x_msg_data,
549                               p_ctcv_rec=>p_ctcv_tbl(i));
550           if (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
551             x_return_status := l_return_status;
552             raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
553           elsif (l_return_status = OKC_API.G_RET_STS_ERROR) then
554             x_return_status := l_return_status;
555           end if;
556           EXIT WHEN (i=p_ctcv_tbl.LAST);
557           i := p_ctcv_tbl.NEXT(i);
558         END LOOP;
559       end if;
560 exception
561 when others then NULL;
562 end lock_contact;
563 
564 -- Start of comments
565 --
566 -- Procedure Name  : validate_contact
567 -- Description     :
568 -- Business Rules  :
569 -- Parameters      :
570 -- Version         : 1.0
571 -- End of comments
572 procedure validate_contact(p_api_version	IN	NUMBER,
573                               p_init_msg_list	IN	VARCHAR2 ,
574                               x_return_status	OUT NOCOPY	VARCHAR2,
575                               x_msg_count	OUT NOCOPY	NUMBER,
576                               x_msg_data	OUT NOCOPY	VARCHAR2,
577                               p_ctcv_rec	IN	ctcv_rec_type) is
578 l_api_name                     CONSTANT VARCHAR2(30) := 'validate_contact';
579 l_api_version                  CONSTANT NUMBER := 1;
580 l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
581 begin
582   l_return_status := OKC_API.START_ACTIVITY(substr(l_api_name,1,26),
583                                               G_PKG_NAME,
584                                               p_init_msg_list,
585                                               l_api_version,
586                                               p_api_version,
587                                               '_PUB',
588                                               x_return_status);
589   IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
590     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
591   ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
592     RAISE OKC_API.G_EXCEPTION_ERROR;
593   END IF;
594   --
595   -- Call Before Logic Hook
596   --
597   g_ctcv_rec := p_ctcv_rec;
598   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'B');
599   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
600     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
601   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
602     raise OKC_API.G_EXCEPTION_ERROR;
603   END IF;
604   reset(p_ctcv_rec);
605   OKC_CONTRACT_PARTY_PVT.validate_contact(p_api_version,
606                               p_init_msg_list,
607                               x_return_status,
608                               x_msg_count,
609                               x_msg_data,
610                               g_ctcv_rec);
611   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
612     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
613   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
614     RAISE OKC_API.G_EXCEPTION_ERROR;
615   END IF;
616   --
617   -- Call After Logic Hook
618   --
619   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'A');
620   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
621     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
622   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
623     raise OKC_API.G_EXCEPTION_ERROR;
624   END IF;
625   OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
626   EXCEPTION
627      WHEN OKC_API.G_EXCEPTION_ERROR THEN
628        x_return_status := OKC_API.HANDLE_EXCEPTIONS
629        (substr(l_api_name,1,26),
630         G_PKG_NAME,
631         'OKC_API.G_RET_STS_ERROR',
632         x_msg_count,
633         x_msg_data,
634         '_PUB');
635      WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
636        x_return_status := OKC_API.HANDLE_EXCEPTIONS
637        (substr(l_api_name,1,26),
638         G_PKG_NAME,
639         'OKC_API.G_RET_STS_UNEXP_ERROR',
640         x_msg_count,
641         x_msg_data,
642         '_PUB');
643      WHEN OTHERS THEN
644        x_return_status := OKC_API.HANDLE_EXCEPTIONS
645        (substr(l_api_name,1,26),
646         G_PKG_NAME,
647         'OTHERS',
648         x_msg_count,
649         x_msg_data,
650         '_PUB');
651 end validate_contact;
652 
653 -- Start of comments
654 --
655 -- Procedure Name  : validate_contact
656 -- Description     :
657 -- Business Rules  :
658 -- Parameters      :
659 -- Version         : 1.0
660 -- End of comments
661 procedure validate_contact(p_api_version	IN	NUMBER,
662                               p_init_msg_list	IN	VARCHAR2 ,
663                               x_return_status	OUT NOCOPY	VARCHAR2,
664                               x_msg_count	OUT NOCOPY	NUMBER,
665                               x_msg_data	OUT NOCOPY	VARCHAR2,
666                               p_ctcv_tbl	IN	ctcv_tbl_type) is
667 i NUMBER;
668 l_return_status	VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
669 begin
670      OKC_API.init_msg_list(p_init_msg_list);
671       x_return_status:= OKC_API.G_RET_STS_SUCCESS;
672       if (p_ctcv_tbl.COUNT>0) then
673         i := p_ctcv_tbl.FIRST;
674         LOOP
675 	    validate_contact(p_api_version=>p_api_version,
676                               p_init_msg_list=>OKC_API.G_FALSE,
677                               x_return_status=>l_return_status,
678                               x_msg_count=>x_msg_count,
679                               x_msg_data=>x_msg_data,
680                               p_ctcv_rec=>p_ctcv_tbl(i));
681           if (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
682             x_return_status := l_return_status;
683             raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
684           elsif (l_return_status = OKC_API.G_RET_STS_ERROR) then
685             x_return_status := l_return_status;
686           end if;
687           EXIT WHEN (i=p_ctcv_tbl.LAST);
688           i := p_ctcv_tbl.NEXT(i);
689         END LOOP;
690       end if;
691 exception
692 when others then NULL;
693 end validate_contact;
694 
695 -- Start of comments
696 --
697 -- Procedure Name  : create_k_party_role
698 -- Description     :
699 -- Business Rules  :
700 -- Parameters      :
701 -- Version         : 1.0
702 -- End of comments
703 procedure create_k_party_role(p_api_version	IN	NUMBER,
704                               p_init_msg_list	IN	VARCHAR2 ,
705                               x_return_status	OUT NOCOPY	VARCHAR2,
706                               x_msg_count	OUT NOCOPY	NUMBER,
707                               x_msg_data	OUT NOCOPY	VARCHAR2,
708                               p_cplv_rec	IN	cplv_rec_type,
709                               x_cplv_rec	OUT NOCOPY	cplv_rec_type) is
710 l_api_name                     CONSTANT VARCHAR2(30) := 'create_k_party_role';
711 l_api_version                  CONSTANT NUMBER := 1;
712 l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
713 begin
714   l_return_status := OKC_API.START_ACTIVITY(substr(l_api_name,1,26),
715                                               G_PKG_NAME,
716                                               p_init_msg_list,
717                                               l_api_version,
718                                               p_api_version,
719                                               '_PUB',
720                                               x_return_status);
721   IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
722     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
723   ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
724     RAISE OKC_API.G_EXCEPTION_ERROR;
725   END IF;
726   --
727   -- Call Before Logic Hook
728   --
729   g_cplv_rec := p_cplv_rec;
730   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'B');
731   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
732     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
733   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
734     raise OKC_API.G_EXCEPTION_ERROR;
735   END IF;
736   reset(p_cplv_rec);
737   OKC_CONTRACT_PARTY_PVT.create_k_party_role(p_api_version,
738                               p_init_msg_list,
739                               x_return_status,
740                               x_msg_count,
741                               x_msg_data,
742                               g_cplv_rec,
743                               x_cplv_rec);
744   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
745     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
746   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
747     RAISE OKC_API.G_EXCEPTION_ERROR;
748   END IF;
749   --
750   -- Call After Logic Hook
751   --
752   g_cplv_rec := x_cplv_rec;
753   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'A');
754   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
755     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
756   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
757     raise OKC_API.G_EXCEPTION_ERROR;
758   END IF;
759   OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
760   EXCEPTION
761      WHEN OKC_API.G_EXCEPTION_ERROR THEN
762        x_return_status := OKC_API.HANDLE_EXCEPTIONS
763        (substr(l_api_name,1,26),
764         G_PKG_NAME,
765         'OKC_API.G_RET_STS_ERROR',
766         x_msg_count,
767         x_msg_data,
768         '_PUB');
769      WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
770        x_return_status := OKC_API.HANDLE_EXCEPTIONS
771        (substr(l_api_name,1,26),
772         G_PKG_NAME,
773         'OKC_API.G_RET_STS_UNEXP_ERROR',
774         x_msg_count,
775         x_msg_data,
776         '_PUB');
777      WHEN OTHERS THEN
778        x_return_status := OKC_API.HANDLE_EXCEPTIONS
779        (substr(l_api_name,1,26),
780         G_PKG_NAME,
781         'OTHERS',
782         x_msg_count,
783         x_msg_data,
784         '_PUB');
785 end create_k_party_role;
786 
787 -- Start of comments
788 --
789 -- Procedure Name  : create_k_party_role
790 -- Description     :
791 -- Business Rules  :
792 -- Parameters      :
793 -- Version         : 1.0
794 -- End of comments
795 procedure create_k_party_role(p_api_version	IN	NUMBER,
796                               p_init_msg_list	IN	VARCHAR2 ,
797                               x_return_status	OUT NOCOPY	VARCHAR2,
798                               x_msg_count	OUT NOCOPY	NUMBER,
799                               x_msg_data	OUT NOCOPY	VARCHAR2,
800                               p_cplv_tbl	IN	cplv_tbl_type,
801                               x_cplv_tbl	OUT NOCOPY	cplv_tbl_type) is
802 i NUMBER;
803 l_return_status	VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
804 begin
805      OKC_API.init_msg_list(p_init_msg_list);
806       x_return_status:= OKC_API.G_RET_STS_SUCCESS;
807       if (p_cplv_tbl.COUNT>0) then
808         i := p_cplv_tbl.FIRST;
809         LOOP
810 	    create_k_party_role(p_api_version=>p_api_version,
811                               p_init_msg_list=>OKC_API.G_FALSE,
812                               x_return_status=>l_return_status,
813                               x_msg_count=>x_msg_count,
814                               x_msg_data=>x_msg_data,
815                               p_cplv_rec=>p_cplv_tbl(i),
816                               x_cplv_rec=>x_cplv_tbl(i));
817           if (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
818             x_return_status := l_return_status;
819             raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
820           elsif (l_return_status = OKC_API.G_RET_STS_ERROR) then
821             x_return_status := l_return_status;
822           end if;
823           EXIT WHEN (i=p_cplv_tbl.LAST);
824           i := p_cplv_tbl.NEXT(i);
825         END LOOP;
826       end if;
827 exception
828 when others then NULL;
829 end create_k_party_role;
830 
831 -- Start of comments
832 --
833 -- Procedure Name  : update_k_party_role
834 -- Description     :
835 -- Business Rules  :
836 -- Parameters      :
837 -- Version         : 1.0
838 -- End of comments
839 procedure update_k_party_role(p_api_version	IN	NUMBER,
840                               p_init_msg_list	IN	VARCHAR2 ,
841                               x_return_status	OUT NOCOPY	VARCHAR2,
842                               x_msg_count	OUT NOCOPY	NUMBER,
843                               x_msg_data	OUT NOCOPY	VARCHAR2,
844                               p_cplv_rec	IN	cplv_rec_type,
845                               x_cplv_rec	OUT NOCOPY	cplv_rec_type) is
846 l_api_name                     CONSTANT VARCHAR2(30) := 'update_k_party_role';
847 l_api_version                  CONSTANT NUMBER := 1;
848 l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
849 begin
850   l_return_status := OKC_API.START_ACTIVITY(substr(l_api_name,1,26),
851                                               G_PKG_NAME,
852                                               p_init_msg_list,
853                                               l_api_version,
854                                               p_api_version,
855                                               '_PUB',
856                                               x_return_status);
857   IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
858     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
859   ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
860     RAISE OKC_API.G_EXCEPTION_ERROR;
861   END IF;
862   --
863   -- Call Before Logic Hook
864   --
865   g_cplv_rec := p_cplv_rec;
866   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'B');
867   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
868     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
869   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
870     raise OKC_API.G_EXCEPTION_ERROR;
871   END IF;
872   reset(p_cplv_rec);
873   OKC_CONTRACT_PARTY_PVT.update_k_party_role(p_api_version,
874                               p_init_msg_list,
875                               x_return_status,
876                               x_msg_count,
877                               x_msg_data,
878                               g_cplv_rec,
879                               x_cplv_rec);
880   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
881     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
882   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
883     RAISE OKC_API.G_EXCEPTION_ERROR;
884   END IF;
885   --
886   -- Call After Logic Hook
887   --
888   g_cplv_rec := x_cplv_rec;
889   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'A');
890   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
891     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
892   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
893     raise OKC_API.G_EXCEPTION_ERROR;
894   END IF;
895   OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
896   EXCEPTION
897      WHEN OKC_API.G_EXCEPTION_ERROR THEN
898        x_return_status := OKC_API.HANDLE_EXCEPTIONS
899        (substr(l_api_name,1,26),
900         G_PKG_NAME,
901         'OKC_API.G_RET_STS_ERROR',
902         x_msg_count,
903         x_msg_data,
904         '_PUB');
905      WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
906        x_return_status := OKC_API.HANDLE_EXCEPTIONS
907        (substr(l_api_name,1,26),
908         G_PKG_NAME,
909         'OKC_API.G_RET_STS_UNEXP_ERROR',
910         x_msg_count,
911         x_msg_data,
912         '_PUB');
913      WHEN OTHERS THEN
914        x_return_status := OKC_API.HANDLE_EXCEPTIONS
915        (substr(l_api_name,1,26),
916         G_PKG_NAME,
917         'OTHERS',
918         x_msg_count,
919         x_msg_data,
920         '_PUB');
921 end update_k_party_role;
922 
923 -- Start of comments
924 --
925 -- Procedure Name  : update_k_party_role
926 -- Description     :
927 -- Business Rules  :
928 -- Parameters      :
929 -- Version         : 1.0
930 -- End of comments
931 procedure update_k_party_role(p_api_version	IN	NUMBER,
932                               p_init_msg_list	IN	VARCHAR2 ,
933                               x_return_status	OUT NOCOPY	VARCHAR2,
934                               x_msg_count	OUT NOCOPY	NUMBER,
935                               x_msg_data	OUT NOCOPY	VARCHAR2,
936                               p_cplv_tbl	IN	cplv_tbl_type,
937                               x_cplv_tbl	OUT NOCOPY	cplv_tbl_type) is
938 i NUMBER;
939 l_return_status	VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
940 begin
941      OKC_API.init_msg_list(p_init_msg_list);
942       x_return_status:= OKC_API.G_RET_STS_SUCCESS;
943       if (p_cplv_tbl.COUNT>0) then
944         i := p_cplv_tbl.FIRST;
945         LOOP
946 	    update_k_party_role(p_api_version=>p_api_version,
947                               p_init_msg_list=>OKC_API.G_FALSE,
948                               x_return_status=>l_return_status,
949                               x_msg_count=>x_msg_count,
950                               x_msg_data=>x_msg_data,
951                               p_cplv_rec=>p_cplv_tbl(i),
952                               x_cplv_rec=>x_cplv_tbl(i));
953           if (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
954             x_return_status := l_return_status;
955             raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
956           elsif (l_return_status = OKC_API.G_RET_STS_ERROR) then
957             x_return_status := l_return_status;
958           end if;
959           EXIT WHEN (i=p_cplv_tbl.LAST);
960           i := p_cplv_tbl.NEXT(i);
961         END LOOP;
962       end if;
963 exception
964 when others then NULL;
965 end update_k_party_role;
966 
967 -- Start of comments
968 --
969 -- Procedure Name  : delete_k_party_role
970 -- Description     :
971 -- Business Rules  :
972 -- Parameters      :
973 -- Version         : 1.0
974 -- End of comments
975 procedure delete_k_party_role(p_api_version	IN	NUMBER,
976                               p_init_msg_list	IN	VARCHAR2 ,
977                               x_return_status	OUT NOCOPY	VARCHAR2,
978                               x_msg_count	OUT NOCOPY	NUMBER,
979                               x_msg_data	OUT NOCOPY	VARCHAR2,
980                               p_cplv_rec	IN	cplv_rec_type) is
981 l_api_name                     CONSTANT VARCHAR2(30) := 'delete_k_party_role';
982 l_api_version                  CONSTANT NUMBER := 1;
983 l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
984 begin
985   l_return_status := OKC_API.START_ACTIVITY(substr(l_api_name,1,26),
986                                               G_PKG_NAME,
987                                               p_init_msg_list,
988                                               l_api_version,
989                                               p_api_version,
990                                               '_PUB',
991                                               x_return_status);
992   IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
993     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
994   ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
995     RAISE OKC_API.G_EXCEPTION_ERROR;
996   END IF;
997   --
998   -- Call Before Logic Hook
999   --
1000   g_cplv_rec := p_cplv_rec;
1001   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'B');
1002   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1003     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1004   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
1005     raise OKC_API.G_EXCEPTION_ERROR;
1006   END IF;
1007   reset(p_cplv_rec);
1008   OKC_CONTRACT_PARTY_PVT.delete_k_party_role(p_api_version,
1009                               p_init_msg_list,
1010                               x_return_status,
1011                               x_msg_count,
1012                               x_msg_data,
1013                               g_cplv_rec);
1014   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1015     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1016   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
1017     RAISE OKC_API.G_EXCEPTION_ERROR;
1018   END IF;
1019   --
1020   -- Call After Logic Hook
1021   --
1022   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'A');
1023   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1024     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1025   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
1026     raise OKC_API.G_EXCEPTION_ERROR;
1027   END IF;
1028   OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1029   EXCEPTION
1030      WHEN OKC_API.G_EXCEPTION_ERROR THEN
1031        x_return_status := OKC_API.HANDLE_EXCEPTIONS
1032        (substr(l_api_name,1,26),
1033         G_PKG_NAME,
1034         'OKC_API.G_RET_STS_ERROR',
1035         x_msg_count,
1036         x_msg_data,
1037         '_PUB');
1038      WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1039        x_return_status := OKC_API.HANDLE_EXCEPTIONS
1040        (substr(l_api_name,1,26),
1041         G_PKG_NAME,
1042         'OKC_API.G_RET_STS_UNEXP_ERROR',
1043         x_msg_count,
1044         x_msg_data,
1045         '_PUB');
1046      WHEN OTHERS THEN
1047        x_return_status := OKC_API.HANDLE_EXCEPTIONS
1048        (substr(l_api_name,1,26),
1049         G_PKG_NAME,
1050         'OTHERS',
1051         x_msg_count,
1052         x_msg_data,
1053         '_PUB');
1054 end delete_k_party_role;
1055 
1056 -- Start of comments
1057 --
1058 -- Procedure Name  : delete_k_party_role
1059 -- Description     :
1060 -- Business Rules  :
1061 -- Parameters      :
1062 -- Version         : 1.0
1063 -- End of comments
1064 procedure delete_k_party_role(p_api_version	IN	NUMBER,
1065                               p_init_msg_list	IN	VARCHAR2 ,
1066                               x_return_status	OUT NOCOPY	VARCHAR2,
1067                               x_msg_count	OUT NOCOPY	NUMBER,
1068                               x_msg_data	OUT NOCOPY	VARCHAR2,
1069                               p_cplv_tbl	IN	cplv_tbl_type) is
1070 i NUMBER;
1071 l_return_status	VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1072 begin
1073      OKC_API.init_msg_list(p_init_msg_list);
1074       x_return_status:= OKC_API.G_RET_STS_SUCCESS;
1075       if (p_cplv_tbl.COUNT>0) then
1076         i := p_cplv_tbl.FIRST;
1077         LOOP
1078 	    delete_k_party_role(p_api_version=>p_api_version,
1079                               p_init_msg_list=>OKC_API.G_FALSE,
1080                               x_return_status=>l_return_status,
1081                               x_msg_count=>x_msg_count,
1082                               x_msg_data=>x_msg_data,
1083                               p_cplv_rec=>p_cplv_tbl(i));
1084           if (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
1085             x_return_status := l_return_status;
1086             raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1087           elsif (l_return_status = OKC_API.G_RET_STS_ERROR) then
1088             x_return_status := l_return_status;
1089           end if;
1090           EXIT WHEN (i=p_cplv_tbl.LAST);
1091           i := p_cplv_tbl.NEXT(i);
1092         END LOOP;
1093       end if;
1094 exception
1095 when others then NULL;
1096 end delete_k_party_role;
1097 
1098 -- Start of comments
1099 --
1100 -- Procedure Name  : lock_k_party_role
1101 -- Description     :
1102 -- Business Rules  :
1103 -- Parameters      :
1104 -- Version         : 1.0
1105 -- End of comments
1106 procedure lock_k_party_role(p_api_version	IN	NUMBER,
1107                             p_init_msg_list	IN	VARCHAR2 ,
1108                               x_return_status	OUT NOCOPY	VARCHAR2,
1109                               x_msg_count	OUT NOCOPY	NUMBER,
1110                               x_msg_data	OUT NOCOPY	VARCHAR2,
1111                             p_cplv_rec	IN	cplv_rec_type) is
1112 l_api_name                     CONSTANT VARCHAR2(30) := 'lock_k_party_role';
1113 l_api_version                  CONSTANT NUMBER := 1;
1114 l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1115 begin
1116   l_return_status := OKC_API.START_ACTIVITY(substr(l_api_name,1,26),
1117                                               G_PKG_NAME,
1118                                               p_init_msg_list,
1119                                               l_api_version,
1120                                               p_api_version,
1121                                               '_PUB',
1122                                               x_return_status);
1123   IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1124     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1125   ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1126     RAISE OKC_API.G_EXCEPTION_ERROR;
1127   END IF;
1128   --
1129   -- Call Before Logic Hook
1130   --
1131   g_cplv_rec := p_cplv_rec;
1132   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'B');
1133   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1134     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1135   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
1136     raise OKC_API.G_EXCEPTION_ERROR;
1137   END IF;
1138   reset(p_cplv_rec);
1139   OKC_CONTRACT_PARTY_PVT.lock_k_party_role(p_api_version,
1140                               p_init_msg_list,
1141                               x_return_status,
1142                               x_msg_count,
1143                               x_msg_data,
1144                               g_cplv_rec);
1145   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1146     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1147   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
1148     RAISE OKC_API.G_EXCEPTION_ERROR;
1149   END IF;
1150   --
1151   -- Call After Logic Hook
1152   --
1153   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'A');
1154   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1155     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1156   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
1157     raise OKC_API.G_EXCEPTION_ERROR;
1158   END IF;
1159   OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1160   EXCEPTION
1161      WHEN OKC_API.G_EXCEPTION_ERROR THEN
1162        x_return_status := OKC_API.HANDLE_EXCEPTIONS
1163        (substr(l_api_name,1,26),
1164         G_PKG_NAME,
1165         'OKC_API.G_RET_STS_ERROR',
1166         x_msg_count,
1167         x_msg_data,
1168         '_PUB');
1169      WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1170        x_return_status := OKC_API.HANDLE_EXCEPTIONS
1171        (substr(l_api_name,1,26),
1172         G_PKG_NAME,
1173         'OKC_API.G_RET_STS_UNEXP_ERROR',
1174         x_msg_count,
1175         x_msg_data,
1176         '_PUB');
1177      WHEN OTHERS THEN
1178        x_return_status := OKC_API.HANDLE_EXCEPTIONS
1179        (substr(l_api_name,1,26),
1180         G_PKG_NAME,
1181         'OTHERS',
1182         x_msg_count,
1183         x_msg_data,
1184         '_PUB');
1185 end lock_k_party_role;
1186 
1187 -- Start of comments
1188 --
1189 -- Procedure Name  : lock_k_party_role
1190 -- Description     :
1191 -- Business Rules  :
1192 -- Parameters      :
1193 -- Version         : 1.0
1194 -- End of comments
1195 procedure lock_k_party_role(p_api_version	IN	NUMBER,
1196                             p_init_msg_list	IN	VARCHAR2 ,
1197                               x_return_status	OUT NOCOPY	VARCHAR2,
1198                               x_msg_count	OUT NOCOPY	NUMBER,
1199                               x_msg_data	OUT NOCOPY	VARCHAR2,
1200                             p_cplv_tbl	IN	cplv_tbl_type) is
1201 i NUMBER;
1202 l_return_status	VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1203 begin
1204      OKC_API.init_msg_list(p_init_msg_list);
1205       x_return_status:= OKC_API.G_RET_STS_SUCCESS;
1206       if (p_cplv_tbl.COUNT>0) then
1207         i := p_cplv_tbl.FIRST;
1208         LOOP
1209 	    lock_k_party_role(p_api_version=>p_api_version,
1210                               p_init_msg_list=>OKC_API.G_FALSE,
1211                               x_return_status=>l_return_status,
1212                               x_msg_count=>x_msg_count,
1213                               x_msg_data=>x_msg_data,
1214                               p_cplv_rec=>p_cplv_tbl(i));
1215           if (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
1216             x_return_status := l_return_status;
1217             raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1218           elsif (l_return_status = OKC_API.G_RET_STS_ERROR) then
1219             x_return_status := l_return_status;
1220           end if;
1221           EXIT WHEN (i=p_cplv_tbl.LAST);
1222           i := p_cplv_tbl.NEXT(i);
1223         END LOOP;
1224       end if;
1225 exception
1226 when others then NULL;
1227 end lock_k_party_role;
1228 
1229 -- Start of comments
1230 --
1231 -- Procedure Name  : validate_k_party_role
1232 -- Description     :
1233 -- Business Rules  :
1234 -- Parameters      :
1235 -- Version         : 1.0
1236 -- End of comments
1237 procedure validate_k_party_role(p_api_version	IN	NUMBER,
1238                                 p_init_msg_list	IN	VARCHAR2 ,
1239                               x_return_status	OUT NOCOPY	VARCHAR2,
1240                               x_msg_count	OUT NOCOPY	NUMBER,
1241                               x_msg_data	OUT NOCOPY	VARCHAR2,
1242                                 p_cplv_rec	IN	cplv_rec_type) is
1243 l_api_name                     CONSTANT VARCHAR2(30) := 'validate_k_party_role';
1244 l_api_version                  CONSTANT NUMBER := 1;
1245 l_return_status                VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1246 begin
1247   l_return_status := OKC_API.START_ACTIVITY(substr(l_api_name,1,26),
1248                                               G_PKG_NAME,
1249                                               p_init_msg_list,
1250                                               l_api_version,
1251                                               p_api_version,
1252                                               '_PUB',
1253                                               x_return_status);
1254   IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1255     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1256   ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1257     RAISE OKC_API.G_EXCEPTION_ERROR;
1258   END IF;
1259   --
1260   -- Call Before Logic Hook
1261   --
1262   g_cplv_rec := p_cplv_rec;
1263   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'B');
1264   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1265     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1266   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
1267     raise OKC_API.G_EXCEPTION_ERROR;
1268   END IF;
1269   reset(p_cplv_rec);
1270   OKC_CONTRACT_PARTY_PVT.validate_k_party_role(p_api_version,
1271                               p_init_msg_list,
1272                               x_return_status,
1273                               x_msg_count,
1274                               x_msg_data,
1275                               g_cplv_rec);
1276   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1277     RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1278   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
1279     RAISE OKC_API.G_EXCEPTION_ERROR;
1280   END IF;
1281   --
1282   -- Call After Logic Hook
1283   --
1284   okc_util.call_user_hook(x_return_status, g_pkg_name, l_api_name, 'A');
1285   IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1286     raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1287   ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
1288     raise OKC_API.G_EXCEPTION_ERROR;
1289   END IF;
1290   OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1291   EXCEPTION
1292      WHEN OKC_API.G_EXCEPTION_ERROR THEN
1293        x_return_status := OKC_API.HANDLE_EXCEPTIONS
1294        (substr(l_api_name,1,26),
1295         G_PKG_NAME,
1296         'OKC_API.G_RET_STS_ERROR',
1297         x_msg_count,
1298         x_msg_data,
1299         '_PUB');
1300      WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1301        x_return_status := OKC_API.HANDLE_EXCEPTIONS
1302        (substr(l_api_name,1,26),
1303         G_PKG_NAME,
1304         'OKC_API.G_RET_STS_UNEXP_ERROR',
1305         x_msg_count,
1306         x_msg_data,
1307         '_PUB');
1308      WHEN OTHERS THEN
1309        x_return_status := OKC_API.HANDLE_EXCEPTIONS
1310        (substr(l_api_name,1,26),
1311         G_PKG_NAME,
1312         'OTHERS',
1313         x_msg_count,
1314         x_msg_data,
1315         '_PUB');
1316 end validate_k_party_role;
1317 
1318 -- Start of comments
1319 --
1320 -- Procedure Name  : validate_k_party_role
1321 -- Description     :
1322 -- Business Rules  :
1323 -- Parameters      :
1324 -- Version         : 1.0
1325 -- End of comments
1326 procedure validate_k_party_role(p_api_version	IN	NUMBER,
1327                                 p_init_msg_list	IN	VARCHAR2 ,
1328                               x_return_status	OUT NOCOPY	VARCHAR2,
1329                               x_msg_count	OUT NOCOPY	NUMBER,
1330                               x_msg_data	OUT NOCOPY	VARCHAR2,
1331                                 p_cplv_tbl	IN	cplv_tbl_type) is
1332 i NUMBER;
1333 l_return_status	VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1334 begin
1335      OKC_API.init_msg_list(p_init_msg_list);
1336       x_return_status:= OKC_API.G_RET_STS_SUCCESS;
1337       if (p_cplv_tbl.COUNT>0) then
1338         i := p_cplv_tbl.FIRST;
1339         LOOP
1340 	    validate_k_party_role(p_api_version=>p_api_version,
1341                               p_init_msg_list=>OKC_API.G_FALSE,
1342                               x_return_status=>l_return_status,
1343                               x_msg_count=>x_msg_count,
1344                               x_msg_data=>x_msg_data,
1345                               p_cplv_rec=>p_cplv_tbl(i));
1346           if (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
1347             x_return_status := l_return_status;
1348             raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1349           elsif (l_return_status = OKC_API.G_RET_STS_ERROR) then
1350             x_return_status := l_return_status;
1351           end if;
1352           EXIT WHEN (i=p_cplv_tbl.LAST);
1353           i := p_cplv_tbl.NEXT(i);
1354         END LOOP;
1355       end if;
1356 exception
1357 when others then NULL;
1358 end validate_k_party_role;
1359 
1360 -- Start of comments
1361 --
1362 -- Procedure Name  : add_language
1363 -- Description     :
1364 -- Business Rules  :
1365 -- Parameters      :
1366 -- Version         : 1.0
1367 -- End of comments
1368 
1369 procedure add_language is
1370 begin
1371   OKC_CONTRACT_PARTY_PVT.add_language;
1372 end add_language;
1373 
1374 
1375 end OKC_CONTRACT_PARTY_PUB;