[Home] [Help]
PACKAGE BODY: APPS.OKS_ACM_PVT
Source
1 PACKAGE BODY OKS_ACM_PVT AS
2 /* $Header: OKSACTMB.pls 120.0 2005/05/25 17:52:07 appldev noship $ */
3 ---------------------------------------------------------------------------
4 -- PROCEDURE load_error_tbl
5 ---------------------------------------------------------------------------
6 PROCEDURE load_error_tbl (
7 px_error_rec IN OUT NOCOPY OKC_API.ERROR_REC_TYPE,
8 px_error_tbl IN OUT NOCOPY OKC_API.ERROR_TBL_TYPE) IS
9
10 j INTEGER := NVL(px_error_tbl.LAST, 0) + 1;
11 last_msg_idx INTEGER := FND_MSG_PUB.COUNT_MSG;
12 l_msg_idx INTEGER := FND_MSG_PUB.G_NEXT;
13 BEGIN
14 -- FND_MSG_PUB has a small error in it. If we call FND_MSG_PUB.COUNT_AND_GET before
15 -- we call FND_MSG_PUB.GET, the variable FND_MSG_PUB uses to control the index of the
16 -- message stack gets set to 1. This makes sense until we call FND_MSG_PUB.GET which
17 -- automatically increments the index by 1, (making it 2), however, when the GET function
18 -- attempts to pull message 2, we get a NO_DATA_FOUND exception because there isn't any
19 -- message 2. To circumvent this problem, check the amount of messages and compensate.
20 -- Again, this error only occurs when 1 message is on the stack because COUNT_AND_GET
21 -- will only update the index variable when 1 and only 1 message is on the stack.
22 IF (last_msg_idx = 1) THEN
23 l_msg_idx := FND_MSG_PUB.G_FIRST;
24 END IF;
25 LOOP
26 fnd_msg_pub.get(
27 p_msg_index => l_msg_idx,
28 p_encoded => fnd_api.g_false,
29 p_data => px_error_rec.msg_data,
30 p_msg_index_out => px_error_rec.msg_count);
31 px_error_tbl(j) := px_error_rec;
32 j := j + 1;
33 EXIT WHEN (px_error_rec.msg_count = last_msg_idx);
34 END LOOP;
35 END load_error_tbl;
36 ---------------------------------------------------------------------------
37 -- FUNCTION find_highest_exception
38 ---------------------------------------------------------------------------
39 -- Finds the highest exception (G_RET_STS_UNEXP_ERROR)
40 -- in a OKC_API.ERROR_TBL_TYPE, and returns it.
41 FUNCTION find_highest_exception(
42 p_error_tbl IN OKC_API.ERROR_TBL_TYPE
43 ) RETURN VARCHAR2 IS
44 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
45 i INTEGER := 1;
46 BEGIN
47 IF (p_error_tbl.COUNT > 0) THEN
48 i := p_error_tbl.FIRST;
49 LOOP
50 IF (p_error_tbl(i).error_type <> OKC_API.G_RET_STS_SUCCESS) THEN
51 IF (l_return_status <> OKC_API.G_RET_STS_UNEXP_ERROR) THEN
52 l_return_status := p_error_tbl(i).error_type;
53 END IF;
54 END IF;
55 EXIT WHEN (i = p_error_tbl.LAST);
56 i := p_error_tbl.NEXT(i);
57 END LOOP;
58 END IF;
59 RETURN(l_return_status);
60 END find_highest_exception;
61 ---------------------------------------------------------------------------
62 -- FUNCTION get_seq_id
63 ---------------------------------------------------------------------------
64 FUNCTION get_seq_id RETURN NUMBER IS
65 BEGIN
66 RETURN(okc_p_util.raw_to_number(sys_guid()));
67 END get_seq_id;
68
69 ---------------------------------------------------------------------------
70 -- PROCEDURE qc
71 ---------------------------------------------------------------------------
72 PROCEDURE qc IS
73 BEGIN
74 null;
75 END qc;
76
77 ---------------------------------------------------------------------------
78 -- PROCEDURE change_version
79 ---------------------------------------------------------------------------
80 PROCEDURE change_version IS
81 BEGIN
82 null;
83 END change_version;
84
85 ---------------------------------------------------------------------------
86 -- PROCEDURE api_copy
87 ---------------------------------------------------------------------------
88 PROCEDURE api_copy IS
89 BEGIN
90 null;
91 END api_copy;
92
93 ---------------------------------------------------------------------------
94 -- FUNCTION get_rec for: OKS_ACTION_TIMES_V
95 ---------------------------------------------------------------------------
96 FUNCTION get_rec (
97 p_oks_action_times_v_rec IN oks_action_times_v_rec_type,
98 x_no_data_found OUT NOCOPY BOOLEAN
99 ) RETURN oks_action_times_v_rec_type IS
100 CURSOR oks_atv_pk_csr (p_id IN NUMBER) IS
101 SELECT
102 ID,
103 COV_ACTION_TYPE_ID,
104 CLE_ID,
105 DNZ_CHR_ID,
106 UOM_CODE,
107 SUN_DURATION,
108 MON_DURATION,
109 TUE_DURATION,
110 WED_DURATION,
111 THU_DURATION,
112 FRI_DURATION,
113 SAT_DURATION,
114 SECURITY_GROUP_ID,
115 PROGRAM_APPLICATION_ID,
116 PROGRAM_ID,
117 PROGRAM_UPDATE_DATE,
118 REQUEST_ID,
119 CREATED_BY,
120 CREATION_DATE,
121 LAST_UPDATED_BY,
122 LAST_UPDATE_DATE,
123 LAST_UPDATE_LOGIN,
124 OBJECT_VERSION_NUMBER
125 FROM Oks_Action_Times_V
126 WHERE oks_action_times_v.id = p_id;
127 l_oks_atv_pk oks_atv_pk_csr%ROWTYPE;
128 l_oks_action_times_v_rec oks_action_times_v_rec_type;
129 BEGIN
130 x_no_data_found := TRUE;
131 -- Get current database values
132 OPEN oks_atv_pk_csr (p_oks_action_times_v_rec.id);
133 FETCH oks_atv_pk_csr INTO
134 l_oks_action_times_v_rec.id,
135 l_oks_action_times_v_rec.cov_action_type_id,
136 l_oks_action_times_v_rec.cle_id,
137 l_oks_action_times_v_rec.dnz_chr_id,
138 l_oks_action_times_v_rec.uom_code,
139 l_oks_action_times_v_rec.sun_duration,
140 l_oks_action_times_v_rec.mon_duration,
141 l_oks_action_times_v_rec.tue_duration,
142 l_oks_action_times_v_rec.wed_duration,
143 l_oks_action_times_v_rec.thu_duration,
144 l_oks_action_times_v_rec.fri_duration,
145 l_oks_action_times_v_rec.sat_duration,
146 l_oks_action_times_v_rec.security_group_id,
147 l_oks_action_times_v_rec.program_application_id,
148 l_oks_action_times_v_rec.program_id,
149 l_oks_action_times_v_rec.program_update_date,
150 l_oks_action_times_v_rec.request_id,
151 l_oks_action_times_v_rec.created_by,
152 l_oks_action_times_v_rec.creation_date,
153 l_oks_action_times_v_rec.last_updated_by,
154 l_oks_action_times_v_rec.last_update_date,
155 l_oks_action_times_v_rec.last_update_login,
156 l_oks_action_times_v_rec.object_version_number;
157 x_no_data_found := oks_atv_pk_csr%NOTFOUND;
158 CLOSE oks_atv_pk_csr;
159 RETURN(l_oks_action_times_v_rec);
160 END get_rec;
161
162 ------------------------------------------------------------------
163 -- This version of get_rec sets error messages if no data found --
164 ------------------------------------------------------------------
165 FUNCTION get_rec (
166 p_oks_action_times_v_rec IN oks_action_times_v_rec_type,
167 x_return_status OUT NOCOPY VARCHAR2
168 ) RETURN oks_action_times_v_rec_type IS
169 l_oks_action_times_v_rec oks_action_times_v_rec_type;
170 l_row_notfound BOOLEAN := TRUE;
171 BEGIN
172 x_return_status := OKC_API.G_RET_STS_SUCCESS;
173 l_oks_action_times_v_rec := get_rec(p_oks_action_times_v_rec, l_row_notfound);
174 IF (l_row_notfound) THEN
175 OKC_API.set_message(G_APP_NAME,G_INVALID_VALUE,G_COL_NAME_TOKEN,'ID');
176 x_return_status := OKC_API.G_RET_STS_ERROR;
177 END IF;
178 RETURN(l_oks_action_times_v_rec);
179 END get_rec;
180 -----------------------------------------------------------
181 -- So we don't have to pass an "l_row_notfound" variable --
182 -----------------------------------------------------------
183 FUNCTION get_rec (
184 p_oks_action_times_v_rec IN oks_action_times_v_rec_type
185 ) RETURN oks_action_times_v_rec_type IS
186 l_row_not_found BOOLEAN := TRUE;
187 BEGIN
188 RETURN(get_rec(p_oks_action_times_v_rec, l_row_not_found));
189 END get_rec;
190 ---------------------------------------------------------------------------
191 -- FUNCTION get_rec for: OKS_ACTION_TIMES
192 ---------------------------------------------------------------------------
193 FUNCTION get_rec (
194 p_oks_action_times_rec IN oks_action_times_rec_type,
195 x_no_data_found OUT NOCOPY BOOLEAN
196 ) RETURN oks_action_times_rec_type IS
197 CURSOR oks_at_pk_csr (p_id IN NUMBER) IS
198 SELECT
199 ID,
200 COV_ACTION_TYPE_ID,
201 CLE_ID,
202 DNZ_CHR_ID,
203 UOM_CODE,
204 SUN_DURATION,
205 MON_DURATION,
206 TUE_DURATION,
207 WED_DURATION,
208 THU_DURATION,
209 FRI_DURATION,
210 SAT_DURATION,
211 PROGRAM_APPLICATION_ID,
212 PROGRAM_ID,
213 PROGRAM_UPDATE_DATE,
214 REQUEST_ID,
215 CREATED_BY,
216 CREATION_DATE,
217 LAST_UPDATED_BY,
218 LAST_UPDATE_DATE,
219 LAST_UPDATE_LOGIN,
220 OBJECT_VERSION_NUMBER
221 FROM Oks_Action_Times
222 WHERE oks_action_times.id = p_id;
223 l_oks_at_pk oks_at_pk_csr%ROWTYPE;
224 l_oks_action_times_rec oks_action_times_rec_type;
225 BEGIN
226 x_no_data_found := TRUE;
227 -- Get current database values
228 OPEN oks_at_pk_csr (p_oks_action_times_rec.id);
229 FETCH oks_at_pk_csr INTO
230 l_oks_action_times_rec.id,
231 l_oks_action_times_rec.cov_action_type_id,
232 l_oks_action_times_rec.cle_id,
233 l_oks_action_times_rec.dnz_chr_id,
234 l_oks_action_times_rec.uom_code,
235 l_oks_action_times_rec.sun_duration,
236 l_oks_action_times_rec.mon_duration,
237 l_oks_action_times_rec.tue_duration,
238 l_oks_action_times_rec.wed_duration,
239 l_oks_action_times_rec.thu_duration,
240 l_oks_action_times_rec.fri_duration,
241 l_oks_action_times_rec.sat_duration,
242 l_oks_action_times_rec.program_application_id,
243 l_oks_action_times_rec.program_id,
244 l_oks_action_times_rec.program_update_date,
245 l_oks_action_times_rec.request_id,
246 l_oks_action_times_rec.created_by,
247 l_oks_action_times_rec.creation_date,
248 l_oks_action_times_rec.last_updated_by,
249 l_oks_action_times_rec.last_update_date,
250 l_oks_action_times_rec.last_update_login,
251 l_oks_action_times_rec.object_version_number;
252 x_no_data_found := oks_at_pk_csr%NOTFOUND;
253 CLOSE oks_at_pk_csr;
254 RETURN(l_oks_action_times_rec);
255 END get_rec;
256
257 ------------------------------------------------------------------
258 -- This version of get_rec sets error messages if no data found --
259 ------------------------------------------------------------------
260 FUNCTION get_rec (
261 p_oks_action_times_rec IN oks_action_times_rec_type,
262 x_return_status OUT NOCOPY VARCHAR2
263 ) RETURN oks_action_times_rec_type IS
264 l_oks_action_times_rec oks_action_times_rec_type;
265 l_row_notfound BOOLEAN := TRUE;
266 BEGIN
267 x_return_status := OKC_API.G_RET_STS_SUCCESS;
268 l_oks_action_times_rec := get_rec(p_oks_action_times_rec, l_row_notfound);
269 IF (l_row_notfound) THEN
270 OKC_API.set_message(G_APP_NAME,G_INVALID_VALUE,G_COL_NAME_TOKEN,'ID');
271 x_return_status := OKC_API.G_RET_STS_ERROR;
272 END IF;
273 RETURN(l_oks_action_times_rec);
274 END get_rec;
275 -----------------------------------------------------------
276 -- So we don't have to pass an "l_row_notfound" variable --
277 -----------------------------------------------------------
278 FUNCTION get_rec (
279 p_oks_action_times_rec IN oks_action_times_rec_type
280 ) RETURN oks_action_times_rec_type IS
281 l_row_not_found BOOLEAN := TRUE;
282 BEGIN
283 RETURN(get_rec(p_oks_action_times_rec, l_row_not_found));
284 END get_rec;
285 ---------------------------------------------------------------------------
286 -- FUNCTION null_out_defaults for: OKS_ACTION_TIMES_V
287 ---------------------------------------------------------------------------
288 FUNCTION null_out_defaults (
289 p_oks_action_times_v_rec IN oks_action_times_v_rec_type
290 ) RETURN oks_action_times_v_rec_type IS
291 l_oks_action_times_v_rec oks_action_times_v_rec_type := p_oks_action_times_v_rec;
292 BEGIN
293 IF (l_oks_action_times_v_rec.id = OKC_API.G_MISS_NUM ) THEN
294 l_oks_action_times_v_rec.id := NULL;
295 END IF;
296 IF (l_oks_action_times_v_rec.cov_action_type_id = OKC_API.G_MISS_NUM ) THEN
297 l_oks_action_times_v_rec.cov_action_type_id := NULL;
298 END IF;
299 IF (l_oks_action_times_v_rec.cle_id = OKC_API.G_MISS_NUM ) THEN
300 l_oks_action_times_v_rec.cle_id := NULL;
301 END IF;
302 IF (l_oks_action_times_v_rec.dnz_chr_id = OKC_API.G_MISS_NUM ) THEN
303 l_oks_action_times_v_rec.dnz_chr_id := NULL;
304 END IF;
305 IF (l_oks_action_times_v_rec.uom_code = OKC_API.G_MISS_CHAR ) THEN
306 l_oks_action_times_v_rec.uom_code := NULL;
307 END IF;
308 IF (l_oks_action_times_v_rec.sun_duration = OKC_API.G_MISS_NUM ) THEN
309 l_oks_action_times_v_rec.sun_duration := NULL;
310 END IF;
311 IF (l_oks_action_times_v_rec.mon_duration = OKC_API.G_MISS_NUM ) THEN
312 l_oks_action_times_v_rec.mon_duration := NULL;
313 END IF;
314 IF (l_oks_action_times_v_rec.tue_duration = OKC_API.G_MISS_NUM ) THEN
315 l_oks_action_times_v_rec.tue_duration := NULL;
316 END IF;
317 IF (l_oks_action_times_v_rec.wed_duration = OKC_API.G_MISS_NUM ) THEN
318 l_oks_action_times_v_rec.wed_duration := NULL;
319 END IF;
320 IF (l_oks_action_times_v_rec.thu_duration = OKC_API.G_MISS_NUM ) THEN
321 l_oks_action_times_v_rec.thu_duration := NULL;
322 END IF;
323 IF (l_oks_action_times_v_rec.fri_duration = OKC_API.G_MISS_NUM ) THEN
324 l_oks_action_times_v_rec.fri_duration := NULL;
325 END IF;
326 IF (l_oks_action_times_v_rec.sat_duration = OKC_API.G_MISS_NUM ) THEN
327 l_oks_action_times_v_rec.sat_duration := NULL;
328 END IF;
329 IF (l_oks_action_times_v_rec.security_group_id = OKC_API.G_MISS_NUM ) THEN
330 l_oks_action_times_v_rec.security_group_id := NULL;
331 END IF;
332 IF (l_oks_action_times_v_rec.program_application_id = OKC_API.G_MISS_NUM ) THEN
333 l_oks_action_times_v_rec.program_application_id := NULL;
334 END IF;
335 IF (l_oks_action_times_v_rec.program_id = OKC_API.G_MISS_NUM ) THEN
336 l_oks_action_times_v_rec.program_id := NULL;
337 END IF;
338 IF (l_oks_action_times_v_rec.program_update_date = OKC_API.G_MISS_DATE ) THEN
339 l_oks_action_times_v_rec.program_update_date := NULL;
340 END IF;
341 IF (l_oks_action_times_v_rec.request_id = OKC_API.G_MISS_NUM ) THEN
342 l_oks_action_times_v_rec.request_id := NULL;
343 END IF;
344 IF (l_oks_action_times_v_rec.created_by = OKC_API.G_MISS_NUM ) THEN
345 l_oks_action_times_v_rec.created_by := NULL;
346 END IF;
347 IF (l_oks_action_times_v_rec.creation_date = OKC_API.G_MISS_DATE ) THEN
348 l_oks_action_times_v_rec.creation_date := NULL;
349 END IF;
350 IF (l_oks_action_times_v_rec.last_updated_by = OKC_API.G_MISS_NUM ) THEN
351 l_oks_action_times_v_rec.last_updated_by := NULL;
352 END IF;
353 IF (l_oks_action_times_v_rec.last_update_date = OKC_API.G_MISS_DATE ) THEN
354 l_oks_action_times_v_rec.last_update_date := NULL;
355 END IF;
356 IF (l_oks_action_times_v_rec.last_update_login = OKC_API.G_MISS_NUM ) THEN
357 l_oks_action_times_v_rec.last_update_login := NULL;
358 END IF;
359 IF (l_oks_action_times_v_rec.object_version_number = OKC_API.G_MISS_NUM ) THEN
360 l_oks_action_times_v_rec.object_version_number := NULL;
361 END IF;
362 RETURN(l_oks_action_times_v_rec);
363 END null_out_defaults;
364 ---------------------------------
365 -- Validate_Attributes for: ID --
366 ---------------------------------
367 PROCEDURE validate_id(
368 x_return_status OUT NOCOPY VARCHAR2,
369 p_id IN NUMBER) IS
370 BEGIN
371 x_return_status := OKC_API.G_RET_STS_SUCCESS;
372 IF (p_id = OKC_API.G_MISS_NUM OR
373 p_id IS NULL)
374 THEN
375 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'id');
376 x_return_status := OKC_API.G_RET_STS_ERROR;
377 RAISE G_EXCEPTION_HALT_VALIDATION;
378 END IF;
379 EXCEPTION
380 WHEN G_EXCEPTION_HALT_VALIDATION THEN
381 null;
382 WHEN OTHERS THEN
383 OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
384 ,p_msg_name => G_UNEXPECTED_ERROR
385 ,p_token1 => G_SQLCODE_TOKEN
386 ,p_token1_value => SQLCODE
387 ,p_token2 => G_SQLERRM_TOKEN
388 ,p_token2_value => SQLERRM);
389 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
390 END validate_id;
391 ----------------------------------------------------
392 -- Validate_Attributes for: OBJECT_VERSION_NUMBER --
393 ----------------------------------------------------
394 PROCEDURE validate_object_version_number(
395 x_return_status OUT NOCOPY VARCHAR2,
396 p_object_version_number IN NUMBER) IS
397 BEGIN
398 x_return_status := OKC_API.G_RET_STS_SUCCESS;
399 IF (p_object_version_number = OKC_API.G_MISS_NUM OR
400 p_object_version_number IS NULL)
401 THEN
402 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'object_version_number');
403 x_return_status := OKC_API.G_RET_STS_ERROR;
404 RAISE G_EXCEPTION_HALT_VALIDATION;
405 END IF;
406 EXCEPTION
407 WHEN G_EXCEPTION_HALT_VALIDATION THEN
408 null;
409 WHEN OTHERS THEN
410 OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
411 ,p_msg_name => G_UNEXPECTED_ERROR
412 ,p_token1 => G_SQLCODE_TOKEN
413 ,p_token1_value => SQLCODE
414 ,p_token2 => G_SQLERRM_TOKEN
415 ,p_token2_value => SQLERRM);
416 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
417 END validate_object_version_number;
418 ---------------------------------------------------------------------------
419 -- FUNCTION Validate_Attributes
420 ---------------------------------------------------------------------------
421 ------------------------------------------------
422 -- Validate_Attributes for:OKS_ACTION_TIMES_V --
423 ------------------------------------------------
424 FUNCTION Validate_Attributes (
425 p_oks_action_times_v_rec IN oks_action_times_v_rec_type
426 ) RETURN VARCHAR2 IS
427 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
428 x_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
429 BEGIN
430 -----------------------------
431 -- Column Level Validation --
432 -----------------------------
433 -- ***
434 -- id
435 -- ***
436 validate_id(x_return_status, p_oks_action_times_v_rec.id);
437 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
438 l_return_status := x_return_status;
439 RAISE G_EXCEPTION_HALT_VALIDATION;
440 END IF;
441
442 -- ***
443 -- object_version_number
444 -- ***
445 validate_object_version_number(x_return_status, p_oks_action_times_v_rec.object_version_number);
446 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
447 l_return_status := x_return_status;
448 RAISE G_EXCEPTION_HALT_VALIDATION;
449 END IF;
450
451 RETURN(l_return_status);
452 EXCEPTION
453 WHEN G_EXCEPTION_HALT_VALIDATION THEN
454 RETURN(l_return_status);
455 WHEN OTHERS THEN
456 OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
457 ,p_msg_name => G_UNEXPECTED_ERROR
458 ,p_token1 => G_SQLCODE_TOKEN
459 ,p_token1_value => SQLCODE
460 ,p_token2 => G_SQLERRM_TOKEN
461 ,p_token2_value => SQLERRM);
462 l_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
463 RETURN(l_return_status);
464 END Validate_Attributes;
465 ---------------------------------------------------------------------------
466 -- PROCEDURE Validate_Record
467 ---------------------------------------------------------------------------
468 --------------------------------------------
469 -- Validate Record for:OKS_ACTION_TIMES_V --
470 --------------------------------------------
471 FUNCTION Validate_Record (
472 p_oks_action_times_v_rec IN oks_action_times_v_rec_type,
473 p_db_oks_action_times_v_rec IN oks_action_times_v_rec_type
474 ) RETURN VARCHAR2 IS
475 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
476 BEGIN
477 RETURN (l_return_status);
478 END Validate_Record;
479 FUNCTION Validate_Record (
480 p_oks_action_times_v_rec IN oks_action_times_v_rec_type
481 ) RETURN VARCHAR2 IS
482 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
483 l_db_oks_action_times_v_rec oks_action_times_v_rec_type := get_rec(p_oks_action_times_v_rec);
484 BEGIN
485 l_return_status := Validate_Record(p_oks_action_times_v_rec => p_oks_action_times_v_rec,
486 p_db_oks_action_times_v_rec => l_db_oks_action_times_v_rec);
487 RETURN (l_return_status);
488 END Validate_Record;
489
490 ---------------------------------------------------------------------------
491 -- PROCEDURE Migrate
492 ---------------------------------------------------------------------------
493 PROCEDURE migrate (
494 p_from IN oks_action_times_v_rec_type,
495 p_to IN OUT NOCOPY oks_action_times_rec_type
496 ) IS
497 BEGIN
498 p_to.id := p_from.id;
499 p_to.cov_action_type_id := p_from.cov_action_type_id;
500 p_to.cle_id := p_from.cle_id;
501 p_to.dnz_chr_id := p_from.dnz_chr_id;
502 p_to.uom_code := p_from.uom_code;
503 p_to.sun_duration := p_from.sun_duration;
504 p_to.mon_duration := p_from.mon_duration;
505 p_to.tue_duration := p_from.tue_duration;
506 p_to.wed_duration := p_from.wed_duration;
507 p_to.thu_duration := p_from.thu_duration;
508 p_to.fri_duration := p_from.fri_duration;
509 p_to.sat_duration := p_from.sat_duration;
510 p_to.program_application_id := p_from.program_application_id;
511 p_to.program_id := p_from.program_id;
512 p_to.program_update_date := p_from.program_update_date;
513 p_to.request_id := p_from.request_id;
514 p_to.created_by := p_from.created_by;
515 p_to.creation_date := p_from.creation_date;
516 p_to.last_updated_by := p_from.last_updated_by;
517 p_to.last_update_date := p_from.last_update_date;
518 p_to.last_update_login := p_from.last_update_login;
519 p_to.object_version_number := p_from.object_version_number;
520 END migrate;
521 PROCEDURE migrate (
522 p_from IN oks_action_times_rec_type,
523 p_to IN OUT NOCOPY oks_action_times_v_rec_type
524 ) IS
525 BEGIN
526 p_to.id := p_from.id;
527 p_to.cov_action_type_id := p_from.cov_action_type_id;
528 p_to.cle_id := p_from.cle_id;
529 p_to.dnz_chr_id := p_from.dnz_chr_id;
530 p_to.uom_code := p_from.uom_code;
531 p_to.sun_duration := p_from.sun_duration;
532 p_to.mon_duration := p_from.mon_duration;
533 p_to.tue_duration := p_from.tue_duration;
534 p_to.wed_duration := p_from.wed_duration;
535 p_to.thu_duration := p_from.thu_duration;
536 p_to.fri_duration := p_from.fri_duration;
537 p_to.sat_duration := p_from.sat_duration;
538 p_to.program_application_id := p_from.program_application_id;
539 p_to.program_id := p_from.program_id;
540 p_to.program_update_date := p_from.program_update_date;
541 p_to.request_id := p_from.request_id;
542 p_to.created_by := p_from.created_by;
543 p_to.creation_date := p_from.creation_date;
544 p_to.last_updated_by := p_from.last_updated_by;
545 p_to.last_update_date := p_from.last_update_date;
546 p_to.last_update_login := p_from.last_update_login;
547 p_to.object_version_number := p_from.object_version_number;
548 END migrate;
549 ---------------------------------------------------------------------------
550 -- PROCEDURE validate_row
551 ---------------------------------------------------------------------------
552 -----------------------------------------
553 -- validate_row for:OKS_ACTION_TIMES_V --
554 -----------------------------------------
555 PROCEDURE validate_row(
556 p_api_version IN NUMBER,
557 p_init_msg_list IN VARCHAR2,
558 x_return_status OUT NOCOPY VARCHAR2,
559 x_msg_count OUT NOCOPY NUMBER,
560 x_msg_data OUT NOCOPY VARCHAR2,
561 p_oks_action_times_v_rec IN oks_action_times_v_rec_type) IS
562
563 l_api_version CONSTANT NUMBER := 1;
564 l_api_name CONSTANT VARCHAR2(30) := 'V_validate_row';
565 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
566 l_oks_action_times_v_rec oks_action_times_v_rec_type := p_oks_action_times_v_rec;
567 l_oks_action_times_rec oks_action_times_rec_type;
568 l_oks_action_times_rec oks_action_times_rec_type;
569 BEGIN
570 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
571 G_PKG_NAME,
572 p_init_msg_list,
573 l_api_version,
574 p_api_version,
575 '_PVT',
576 x_return_status);
577 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
578 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
579 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
580 RAISE OKC_API.G_EXCEPTION_ERROR;
581 END IF;
582 --- Validate all non-missing attributes (Item Level Validation)
583 l_return_status := Validate_Attributes(l_oks_action_times_v_rec);
584 --- If any errors happen abort API
585 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
586 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
587 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
588 RAISE OKC_API.G_EXCEPTION_ERROR;
589 END IF;
590 l_return_status := Validate_Record(l_oks_action_times_v_rec);
591 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
592 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
593 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
594 RAISE OKC_API.G_EXCEPTION_ERROR;
595 END IF;
596 x_return_status := l_return_status;
597 EXCEPTION
598 WHEN OKC_API.G_EXCEPTION_ERROR THEN
599 x_return_status := OKC_API.HANDLE_EXCEPTIONS
600 (
601 l_api_name,
602 G_PKG_NAME,
603 'OKC_API.G_RET_STS_ERROR',
604 x_msg_count,
605 x_msg_data,
606 '_PVT'
607 );
608 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
609 x_return_status := OKC_API.HANDLE_EXCEPTIONS
610 (
611 l_api_name,
612 G_PKG_NAME,
613 'OKC_API.G_RET_STS_UNEXP_ERROR',
614 x_msg_count,
615 x_msg_data,
616 '_PVT'
617 );
618 WHEN OTHERS THEN
619 x_return_status := OKC_API.HANDLE_EXCEPTIONS
620 (
621 l_api_name,
622 G_PKG_NAME,
623 'OTHERS',
624 x_msg_count,
625 x_msg_data,
626 '_PVT'
627 );
628 END validate_row;
629 ----------------------------------------------------
630 -- PL/SQL TBL validate_row for:OKS_ACTION_TIMES_V --
631 ----------------------------------------------------
632 PROCEDURE validate_row(
633 p_api_version IN NUMBER,
634 p_init_msg_list IN VARCHAR2,
635 x_return_status OUT NOCOPY VARCHAR2,
636 x_msg_count OUT NOCOPY NUMBER,
637 x_msg_data OUT NOCOPY VARCHAR2,
638 p_oks_action_times_v_tbl IN oks_action_times_v_tbl_type,
639 px_error_tbl IN OUT NOCOPY OKC_API.ERROR_TBL_TYPE) IS
640
641 l_api_version CONSTANT NUMBER := 1;
642 l_api_name CONSTANT VARCHAR2(30) := 'V_error_tbl_validate_row';
643 i NUMBER := 0;
644 BEGIN
645 OKC_API.init_msg_list(p_init_msg_list);
646 -- Make sure PL/SQL table has records in it before passing
647 IF (p_oks_action_times_v_tbl.COUNT > 0) THEN
648 i := p_oks_action_times_v_tbl.FIRST;
649 LOOP
650 DECLARE
651 l_error_rec OKC_API.ERROR_REC_TYPE;
652 BEGIN
653 l_error_rec.api_name := l_api_name;
654 l_error_rec.api_package := G_PKG_NAME;
655 l_error_rec.idx := i;
656 validate_row (
657 p_api_version => p_api_version,
658 p_init_msg_list => OKC_API.G_FALSE,
659 x_return_status => l_error_rec.error_type,
660 x_msg_count => l_error_rec.msg_count,
661 x_msg_data => l_error_rec.msg_data,
662 p_oks_action_times_v_rec => p_oks_action_times_v_tbl(i));
663 IF (l_error_rec.error_type <> OKC_API.G_RET_STS_SUCCESS) THEN
664 l_error_rec.sqlcode := SQLCODE;
665 load_error_tbl(l_error_rec, px_error_tbl);
666 ELSE
667 x_msg_count := l_error_rec.msg_count;
668 x_msg_data := l_error_rec.msg_data;
669 END IF;
670 EXCEPTION
671 WHEN OKC_API.G_EXCEPTION_ERROR THEN
672 l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
673 l_error_rec.sqlcode := SQLCODE;
674 load_error_tbl(l_error_rec, px_error_tbl);
675 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
676 l_error_rec.error_type := OKC_API.G_RET_STS_UNEXP_ERROR;
677 l_error_rec.sqlcode := SQLCODE;
678 load_error_tbl(l_error_rec, px_error_tbl);
679 WHEN OTHERS THEN
680 l_error_rec.error_type := 'OTHERS';
681 l_error_rec.sqlcode := SQLCODE;
682 load_error_tbl(l_error_rec, px_error_tbl);
683 END;
684 EXIT WHEN (i = p_oks_action_times_v_tbl.LAST);
685 i := p_oks_action_times_v_tbl.NEXT(i);
686 END LOOP;
687 END IF;
688 -- Loop through the error_tbl to find the error with the highest severity
689 -- and return it.
690 x_return_status := find_highest_exception(px_error_tbl);
691 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
692 EXCEPTION
693 WHEN OKC_API.G_EXCEPTION_ERROR THEN
694 x_return_status := OKC_API.HANDLE_EXCEPTIONS
695 (
696 l_api_name,
697 G_PKG_NAME,
698 'OKC_API.G_RET_STS_ERROR',
699 x_msg_count,
700 x_msg_data,
701 '_PVT'
702 );
703 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
704 x_return_status := OKC_API.HANDLE_EXCEPTIONS
705 (
706 l_api_name,
707 G_PKG_NAME,
708 'OKC_API.G_RET_STS_UNEXP_ERROR',
709 x_msg_count,
710 x_msg_data,
711 '_PVT'
712 );
713 WHEN OTHERS THEN
714 x_return_status := OKC_API.HANDLE_EXCEPTIONS
715 (
716 l_api_name,
717 G_PKG_NAME,
718 'OTHERS',
719 x_msg_count,
720 x_msg_data,
721 '_PVT'
722 );
723 END validate_row;
724
725 ----------------------------------------------------
726 -- PL/SQL TBL validate_row for:OKS_ACTION_TIMES_V --
727 ----------------------------------------------------
728 PROCEDURE validate_row(
729 p_api_version IN NUMBER,
730 p_init_msg_list IN VARCHAR2,
731 x_return_status OUT NOCOPY VARCHAR2,
732 x_msg_count OUT NOCOPY NUMBER,
733 x_msg_data OUT NOCOPY VARCHAR2,
734 p_oks_action_times_v_tbl IN oks_action_times_v_tbl_type) IS
735
736 l_api_version CONSTANT NUMBER := 1;
737 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_validate_row';
738 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
739 l_error_tbl OKC_API.ERROR_TBL_TYPE;
740 BEGIN
741 OKC_API.init_msg_list(p_init_msg_list);
742 -- Make sure PL/SQL table has records in it before passing
743 IF (p_oks_action_times_v_tbl.COUNT > 0) THEN
744 validate_row (
745 p_api_version => p_api_version,
746 p_init_msg_list => OKC_API.G_FALSE,
747 x_return_status => x_return_status,
748 x_msg_count => x_msg_count,
749 x_msg_data => x_msg_data,
750 p_oks_action_times_v_tbl => p_oks_action_times_v_tbl,
751 px_error_tbl => l_error_tbl);
752 END IF;
753 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
754 EXCEPTION
755 WHEN OKC_API.G_EXCEPTION_ERROR THEN
756 x_return_status := OKC_API.HANDLE_EXCEPTIONS
757 (
758 l_api_name,
759 G_PKG_NAME,
760 'OKC_API.G_RET_STS_ERROR',
761 x_msg_count,
762 x_msg_data,
763 '_PVT'
764 );
765 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
766 x_return_status := OKC_API.HANDLE_EXCEPTIONS
767 (
768 l_api_name,
769 G_PKG_NAME,
770 'OKC_API.G_RET_STS_UNEXP_ERROR',
771 x_msg_count,
772 x_msg_data,
773 '_PVT'
774 );
775 WHEN OTHERS THEN
776 x_return_status := OKC_API.HANDLE_EXCEPTIONS
777 (
778 l_api_name,
779 G_PKG_NAME,
780 'OTHERS',
781 x_msg_count,
782 x_msg_data,
783 '_PVT'
784 );
785 END validate_row;
786
787 ---------------------------------------------------------------------------
788 -- PROCEDURE insert_row
789 ---------------------------------------------------------------------------
790 -------------------------------------
791 -- insert_row for:OKS_ACTION_TIMES --
792 -------------------------------------
793 PROCEDURE insert_row(
794 p_init_msg_list IN VARCHAR2,
795 x_return_status OUT NOCOPY VARCHAR2,
796 x_msg_count OUT NOCOPY NUMBER,
797 x_msg_data OUT NOCOPY VARCHAR2,
798 p_oks_action_times_rec IN oks_action_times_rec_type,
799 x_oks_action_times_rec OUT NOCOPY oks_action_times_rec_type) IS
800
801 l_api_version CONSTANT NUMBER := 1;
802 l_api_name CONSTANT VARCHAR2(30) := 'B_insert_row';
803 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
804 l_oks_action_times_rec oks_action_times_rec_type := p_oks_action_times_rec;
805 l_def_oks_action_times_rec oks_action_times_rec_type;
806 -----------------------------------------
807 -- Set_Attributes for:OKS_ACTION_TIMES --
808 -----------------------------------------
809 FUNCTION Set_Attributes (
810 p_oks_action_times_rec IN oks_action_times_rec_type,
811 x_oks_action_times_rec OUT NOCOPY oks_action_times_rec_type
812 ) RETURN VARCHAR2 IS
813 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
814 BEGIN
815 x_oks_action_times_rec := p_oks_action_times_rec;
816 RETURN(l_return_status);
817 END Set_Attributes;
818 BEGIN
819 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
820 p_init_msg_list,
821 '_PVT',
822 x_return_status);
823 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
824 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
825 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
826 RAISE OKC_API.G_EXCEPTION_ERROR;
827 END IF;
828 --- Setting item atributes
829 l_return_status := Set_Attributes(
830 p_oks_action_times_rec, -- IN
831 l_oks_action_times_rec); -- OUT
832 --- If any errors happen abort API
833 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
834 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
835 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
836 RAISE OKC_API.G_EXCEPTION_ERROR;
837 END IF;
838 INSERT INTO OKS_ACTION_TIMES(
839 id,
840 cov_action_type_id,
841 cle_id,
842 dnz_chr_id,
843 uom_code,
844 sun_duration,
845 mon_duration,
846 tue_duration,
847 wed_duration,
848 thu_duration,
849 fri_duration,
850 sat_duration,
851 program_application_id,
852 program_id,
853 program_update_date,
854 request_id,
855 created_by,
856 creation_date,
857 last_updated_by,
858 last_update_date,
859 last_update_login,
860 object_version_number)
861 VALUES (
862 l_oks_action_times_rec.id,
863 l_oks_action_times_rec.cov_action_type_id,
864 l_oks_action_times_rec.cle_id,
865 l_oks_action_times_rec.dnz_chr_id,
866 l_oks_action_times_rec.uom_code,
867 l_oks_action_times_rec.sun_duration,
868 l_oks_action_times_rec.mon_duration,
869 l_oks_action_times_rec.tue_duration,
870 l_oks_action_times_rec.wed_duration,
871 l_oks_action_times_rec.thu_duration,
872 l_oks_action_times_rec.fri_duration,
873 l_oks_action_times_rec.sat_duration,
874 l_oks_action_times_rec.program_application_id,
875 l_oks_action_times_rec.program_id,
876 l_oks_action_times_rec.program_update_date,
877 l_oks_action_times_rec.request_id,
878 l_oks_action_times_rec.created_by,
879 l_oks_action_times_rec.creation_date,
880 l_oks_action_times_rec.last_updated_by,
881 l_oks_action_times_rec.last_update_date,
882 l_oks_action_times_rec.last_update_login,
883 l_oks_action_times_rec.object_version_number);
884 -- Set OUT values
885 x_oks_action_times_rec := l_oks_action_times_rec;
886 x_return_status := l_return_status;
887 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
888 EXCEPTION
889 WHEN OKC_API.G_EXCEPTION_ERROR THEN
890 x_return_status := OKC_API.HANDLE_EXCEPTIONS
891 (
892 l_api_name,
893 G_PKG_NAME,
894 'OKC_API.G_RET_STS_ERROR',
895 x_msg_count,
896 x_msg_data,
897 '_PVT'
898 );
899 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
900 x_return_status := OKC_API.HANDLE_EXCEPTIONS
901 (
902 l_api_name,
903 G_PKG_NAME,
904 'OKC_API.G_RET_STS_UNEXP_ERROR',
905 x_msg_count,
906 x_msg_data,
907 '_PVT'
908 );
909 WHEN OTHERS THEN
910 x_return_status := OKC_API.HANDLE_EXCEPTIONS
911 (
912 l_api_name,
913 G_PKG_NAME,
914 'OTHERS',
915 x_msg_count,
916 x_msg_data,
917 '_PVT'
918 );
919 END insert_row;
920 ----------------------------------------
921 -- insert_row for :OKS_ACTION_TIMES_V --
922 ----------------------------------------
923 PROCEDURE insert_row(
924 p_api_version IN NUMBER,
925 p_init_msg_list IN VARCHAR2,
926 x_return_status OUT NOCOPY VARCHAR2,
927 x_msg_count OUT NOCOPY NUMBER,
928 x_msg_data OUT NOCOPY VARCHAR2,
929 p_oks_action_times_v_rec IN oks_action_times_v_rec_type,
930 x_oks_action_times_v_rec OUT NOCOPY oks_action_times_v_rec_type) IS
931
932 l_api_version CONSTANT NUMBER := 1;
933 l_api_name CONSTANT VARCHAR2(30) := 'V_insert_row';
934 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
935 l_oks_action_times_v_rec oks_action_times_v_rec_type := p_oks_action_times_v_rec;
936 l_def_oks_action_times_v_rec oks_action_times_v_rec_type;
937 l_oks_action_times_rec oks_action_times_rec_type;
938 lx_oks_action_times_rec oks_action_times_rec_type;
939 -------------------------------
940 -- FUNCTION fill_who_columns --
941 -------------------------------
942 FUNCTION fill_who_columns (
943 p_oks_action_times_v_rec IN oks_action_times_v_rec_type
944 ) RETURN oks_action_times_v_rec_type IS
945 l_oks_action_times_v_rec oks_action_times_v_rec_type := p_oks_action_times_v_rec;
946 BEGIN
947 l_oks_action_times_v_rec.CREATION_DATE := SYSDATE;
948 l_oks_action_times_v_rec.CREATED_BY := FND_GLOBAL.USER_ID;
949 l_oks_action_times_v_rec.LAST_UPDATE_DATE := l_oks_action_times_v_rec.CREATION_DATE;
950 l_oks_action_times_v_rec.LAST_UPDATED_BY := FND_GLOBAL.USER_ID;
951 l_oks_action_times_v_rec.LAST_UPDATE_LOGIN := FND_GLOBAL.LOGIN_ID;
952 RETURN(l_oks_action_times_v_rec);
953 END fill_who_columns;
954 -------------------------------------------
955 -- Set_Attributes for:OKS_ACTION_TIMES_V --
956 -------------------------------------------
957 FUNCTION Set_Attributes (
958 p_oks_action_times_v_rec IN oks_action_times_v_rec_type,
959 x_oks_action_times_v_rec OUT NOCOPY oks_action_times_v_rec_type
960 ) RETURN VARCHAR2 IS
961 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
962 BEGIN
963 x_oks_action_times_v_rec := p_oks_action_times_v_rec;
964 x_oks_action_times_v_rec.OBJECT_VERSION_NUMBER := 1;
965 RETURN(l_return_status);
966 END Set_Attributes;
967 BEGIN
968 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
969 G_PKG_NAME,
970 p_init_msg_list,
971 l_api_version,
972 p_api_version,
973 '_PVT',
974 x_return_status);
975 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
976 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
977 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
978 RAISE OKC_API.G_EXCEPTION_ERROR;
979 END IF;
980 l_oks_action_times_v_rec := null_out_defaults(p_oks_action_times_v_rec);
981 -- Set primary key value
982 l_oks_action_times_v_rec.ID := get_seq_id;
983 -- Setting item attributes
984 l_return_Status := Set_Attributes(
985 l_oks_action_times_v_rec, -- IN
986 l_def_oks_action_times_v_rec); -- OUT
987 --- If any errors happen abort API
988 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
989 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
990 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
991 RAISE OKC_API.G_EXCEPTION_ERROR;
992 END IF;
993 l_def_oks_action_times_v_rec := fill_who_columns(l_def_oks_action_times_v_rec);
994 --- Validate all non-missing attributes (Item Level Validation)
995 l_return_status := Validate_Attributes(l_def_oks_action_times_v_rec);
996 --- If any errors happen abort API
997 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
998 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
999 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1000 RAISE OKC_API.G_EXCEPTION_ERROR;
1001 END IF;
1002 l_return_status := Validate_Record(l_def_oks_action_times_v_rec);
1003 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1004 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1005 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1006 RAISE OKC_API.G_EXCEPTION_ERROR;
1007 END IF;
1008 -----------------------------------------
1009 -- Move VIEW record to "Child" records --
1010 -----------------------------------------
1011 migrate(l_def_oks_action_times_v_rec, l_oks_action_times_rec);
1012 -----------------------------------------------
1013 -- Call the INSERT_ROW for each child record --
1014 -----------------------------------------------
1015 insert_row(
1016 p_init_msg_list,
1017 l_return_status,
1018 x_msg_count,
1019 x_msg_data,
1020 l_oks_action_times_rec,
1021 lx_oks_action_times_rec
1022 );
1023 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1024 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1025 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1026 RAISE OKC_API.G_EXCEPTION_ERROR;
1027 END IF;
1028 migrate(lx_oks_action_times_rec, l_def_oks_action_times_v_rec);
1029 -- Set OUT values
1030 x_oks_action_times_v_rec := l_def_oks_action_times_v_rec;
1031 x_return_status := l_return_status;
1032 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1033 EXCEPTION
1034 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1035 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1036 (
1037 l_api_name,
1038 G_PKG_NAME,
1039 'OKC_API.G_RET_STS_ERROR',
1040 x_msg_count,
1041 x_msg_data,
1042 '_PVT'
1043 );
1044 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1045 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1046 (
1047 l_api_name,
1048 G_PKG_NAME,
1049 'OKC_API.G_RET_STS_UNEXP_ERROR',
1050 x_msg_count,
1051 x_msg_data,
1052 '_PVT'
1053 );
1054 WHEN OTHERS THEN
1055 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1056 (
1057 l_api_name,
1058 G_PKG_NAME,
1059 'OTHERS',
1060 x_msg_count,
1061 x_msg_data,
1062 '_PVT'
1063 );
1064 END insert_row;
1065 ------------------------------------------------------
1066 -- PL/SQL TBL insert_row for:OKS_ACTION_TIMES_V_TBL --
1067 ------------------------------------------------------
1068 PROCEDURE insert_row(
1069 p_api_version IN NUMBER,
1070 p_init_msg_list IN VARCHAR2,
1071 x_return_status OUT NOCOPY VARCHAR2,
1072 x_msg_count OUT NOCOPY NUMBER,
1073 x_msg_data OUT NOCOPY VARCHAR2,
1074 p_oks_action_times_v_tbl IN oks_action_times_v_tbl_type,
1075 x_oks_action_times_v_tbl OUT NOCOPY oks_action_times_v_tbl_type,
1076 px_error_tbl IN OUT NOCOPY OKC_API.ERROR_TBL_TYPE) IS
1077
1078 l_api_version CONSTANT NUMBER := 1;
1079 l_api_name CONSTANT VARCHAR2(30) := 'V_error_tbl_insert_row';
1080 i NUMBER := 0;
1081 BEGIN
1082 OKC_API.init_msg_list(p_init_msg_list);
1083 -- Make sure PL/SQL table has records in it before passing
1084 IF (p_oks_action_times_v_tbl.COUNT > 0) THEN
1085 i := p_oks_action_times_v_tbl.FIRST;
1086 LOOP
1087 DECLARE
1088 l_error_rec OKC_API.ERROR_REC_TYPE;
1089 BEGIN
1090 l_error_rec.api_name := l_api_name;
1091 l_error_rec.api_package := G_PKG_NAME;
1092 l_error_rec.idx := i;
1093 insert_row (
1094 p_api_version => p_api_version,
1095 p_init_msg_list => OKC_API.G_FALSE,
1096 x_return_status => l_error_rec.error_type,
1097 x_msg_count => l_error_rec.msg_count,
1098 x_msg_data => l_error_rec.msg_data,
1099 p_oks_action_times_v_rec => p_oks_action_times_v_tbl(i),
1100 x_oks_action_times_v_rec => x_oks_action_times_v_tbl(i));
1101 IF (l_error_rec.error_type <> OKC_API.G_RET_STS_SUCCESS) THEN
1102 l_error_rec.sqlcode := SQLCODE;
1103 load_error_tbl(l_error_rec, px_error_tbl);
1104 ELSE
1105 x_msg_count := l_error_rec.msg_count;
1106 x_msg_data := l_error_rec.msg_data;
1107 END IF;
1108 EXCEPTION
1109 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1110 l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
1111 l_error_rec.sqlcode := SQLCODE;
1112 load_error_tbl(l_error_rec, px_error_tbl);
1113 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1114 l_error_rec.error_type := OKC_API.G_RET_STS_UNEXP_ERROR;
1115 l_error_rec.sqlcode := SQLCODE;
1116 load_error_tbl(l_error_rec, px_error_tbl);
1117 WHEN OTHERS THEN
1118 l_error_rec.error_type := 'OTHERS';
1119 l_error_rec.sqlcode := SQLCODE;
1120 load_error_tbl(l_error_rec, px_error_tbl);
1121 END;
1122 EXIT WHEN (i = p_oks_action_times_v_tbl.LAST);
1123 i := p_oks_action_times_v_tbl.NEXT(i);
1124 END LOOP;
1125 END IF;
1126 -- Loop through the error_tbl to find the error with the highest severity
1127 -- and return it.
1128 x_return_status := find_highest_exception(px_error_tbl);
1129 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1130 EXCEPTION
1131 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1132 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1133 (
1134 l_api_name,
1135 G_PKG_NAME,
1136 'OKC_API.G_RET_STS_ERROR',
1137 x_msg_count,
1138 x_msg_data,
1139 '_PVT'
1140 );
1141 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1142 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1143 (
1144 l_api_name,
1145 G_PKG_NAME,
1146 'OKC_API.G_RET_STS_UNEXP_ERROR',
1147 x_msg_count,
1148 x_msg_data,
1149 '_PVT'
1150 );
1151 WHEN OTHERS THEN
1152 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1153 (
1154 l_api_name,
1155 G_PKG_NAME,
1156 'OTHERS',
1157 x_msg_count,
1158 x_msg_data,
1159 '_PVT'
1160 );
1161 END insert_row;
1162
1163 ------------------------------------------------------
1164 -- PL/SQL TBL insert_row for:OKS_ACTION_TIMES_V_TBL --
1165 ------------------------------------------------------
1166 -- This procedure is the same as the one above except it does not have a "px_error_tbl" argument.
1167 -- This procedure was create for backward compatibility and simply is a wrapper for the one above.
1168 PROCEDURE insert_row(
1169 p_api_version IN NUMBER,
1170 p_init_msg_list IN VARCHAR2,
1171 x_return_status OUT NOCOPY VARCHAR2,
1172 x_msg_count OUT NOCOPY NUMBER,
1173 x_msg_data OUT NOCOPY VARCHAR2,
1174 p_oks_action_times_v_tbl IN oks_action_times_v_tbl_type,
1175 x_oks_action_times_v_tbl OUT NOCOPY oks_action_times_v_tbl_type) IS
1176
1177 l_api_version CONSTANT NUMBER := 1;
1178 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_insert_row';
1179 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1180 l_error_tbl OKC_API.ERROR_TBL_TYPE;
1181 BEGIN
1182 OKC_API.init_msg_list(p_init_msg_list);
1183 -- Make sure PL/SQL table has records in it before passing
1184 IF (p_oks_action_times_v_tbl.COUNT > 0) THEN
1185 insert_row (
1186 p_api_version => p_api_version,
1187 p_init_msg_list => OKC_API.G_FALSE,
1188 x_return_status => x_return_status,
1189 x_msg_count => x_msg_count,
1190 x_msg_data => x_msg_data,
1191 p_oks_action_times_v_tbl => p_oks_action_times_v_tbl,
1192 x_oks_action_times_v_tbl => x_oks_action_times_v_tbl,
1193 px_error_tbl => l_error_tbl);
1194 END IF;
1195 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1196 EXCEPTION
1197 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1198 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1199 (
1200 l_api_name,
1201 G_PKG_NAME,
1202 'OKC_API.G_RET_STS_ERROR',
1203 x_msg_count,
1204 x_msg_data,
1205 '_PVT'
1206 );
1207 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1208 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1209 (
1210 l_api_name,
1211 G_PKG_NAME,
1212 'OKC_API.G_RET_STS_UNEXP_ERROR',
1213 x_msg_count,
1214 x_msg_data,
1215 '_PVT'
1216 );
1217 WHEN OTHERS THEN
1218 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1219 (
1220 l_api_name,
1221 G_PKG_NAME,
1222 'OTHERS',
1223 x_msg_count,
1224 x_msg_data,
1225 '_PVT'
1226 );
1227 END insert_row;
1228
1229 ---------------------------------------------------------------------------
1230 -- PROCEDURE lock_row
1231 ---------------------------------------------------------------------------
1232 -----------------------------------
1233 -- lock_row for:OKS_ACTION_TIMES --
1234 -----------------------------------
1235 PROCEDURE lock_row(
1236 p_init_msg_list IN VARCHAR2,
1237 x_return_status OUT NOCOPY VARCHAR2,
1238 x_msg_count OUT NOCOPY NUMBER,
1239 x_msg_data OUT NOCOPY VARCHAR2,
1240 p_oks_action_times_rec IN oks_action_times_rec_type) IS
1241
1242 E_Resource_Busy EXCEPTION;
1243 PRAGMA EXCEPTION_INIT(E_Resource_Busy, -00054);
1244 CURSOR lock_csr (p_oks_action_times_rec IN oks_action_times_rec_type) IS
1245 SELECT OBJECT_VERSION_NUMBER
1246 FROM OKS_ACTION_TIMES
1247 WHERE ID = p_oks_action_times_rec.id
1248 AND OBJECT_VERSION_NUMBER = p_oks_action_times_rec.object_version_number
1249 FOR UPDATE OF OBJECT_VERSION_NUMBER NOWAIT;
1250
1251 CURSOR lchk_csr (p_oks_action_times_rec IN oks_action_times_rec_type) IS
1252 SELECT OBJECT_VERSION_NUMBER
1253 FROM OKS_ACTION_TIMES
1254 WHERE ID = p_oks_action_times_rec.id;
1255 l_api_version CONSTANT NUMBER := 1;
1256 l_api_name CONSTANT VARCHAR2(30) := 'B_lock_row';
1257 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1258 l_object_version_number OKS_ACTION_TIMES.OBJECT_VERSION_NUMBER%TYPE;
1259 lc_object_version_number OKS_ACTION_TIMES.OBJECT_VERSION_NUMBER%TYPE;
1260 l_row_notfound BOOLEAN := FALSE;
1261 lc_row_notfound BOOLEAN := FALSE;
1262 BEGIN
1263 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1264 p_init_msg_list,
1265 '_PVT',
1266 x_return_status);
1267 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1268 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1269 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1270 RAISE OKC_API.G_EXCEPTION_ERROR;
1271 END IF;
1272 BEGIN
1273 OPEN lock_csr(p_oks_action_times_rec);
1274 FETCH lock_csr INTO l_object_version_number;
1275 l_row_notfound := lock_csr%NOTFOUND;
1276 CLOSE lock_csr;
1277 EXCEPTION
1278 WHEN E_Resource_Busy THEN
1279 IF (lock_csr%ISOPEN) THEN
1280 CLOSE lock_csr;
1281 END IF;
1282 OKC_API.set_message(G_FND_APP,G_FORM_UNABLE_TO_RESERVE_REC);
1283 RAISE APP_EXCEPTIONS.RECORD_LOCK_EXCEPTION;
1284 END;
1285
1286 IF ( l_row_notfound ) THEN
1287 OPEN lchk_csr(p_oks_action_times_rec);
1288 FETCH lchk_csr INTO lc_object_version_number;
1289 lc_row_notfound := lchk_csr%NOTFOUND;
1290 CLOSE lchk_csr;
1291 END IF;
1292 IF (lc_row_notfound) THEN
1293 OKC_API.set_message(G_FND_APP,G_FORM_RECORD_DELETED);
1294 RAISE OKC_API.G_EXCEPTION_ERROR;
1295 ELSIF lc_object_version_number > p_oks_action_times_rec.object_version_number THEN
1296 OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
1297 RAISE OKC_API.G_EXCEPTION_ERROR;
1298 ELSIF lc_object_version_number <> p_oks_action_times_rec.object_version_number THEN
1299 OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
1300 RAISE OKC_API.G_EXCEPTION_ERROR;
1301 ELSIF lc_object_version_number = -1 THEN
1302 OKC_API.set_message(G_APP_NAME,G_RECORD_LOGICALLY_DELETED);
1303 RAISE OKC_API.G_EXCEPTION_ERROR;
1304 END IF;
1305 x_return_status := l_return_status;
1306 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1307 EXCEPTION
1308 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1309 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1310 (
1311 l_api_name,
1312 G_PKG_NAME,
1313 'OKC_API.G_RET_STS_ERROR',
1314 x_msg_count,
1315 x_msg_data,
1316 '_PVT'
1317 );
1318 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1319 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1320 (
1321 l_api_name,
1322 G_PKG_NAME,
1323 'OKC_API.G_RET_STS_UNEXP_ERROR',
1324 x_msg_count,
1325 x_msg_data,
1326 '_PVT'
1327 );
1328 WHEN OTHERS THEN
1329 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1330 (
1331 l_api_name,
1332 G_PKG_NAME,
1333 'OTHERS',
1334 x_msg_count,
1335 x_msg_data,
1336 '_PVT'
1337 );
1338 END lock_row;
1339 --------------------------------------
1340 -- lock_row for: OKS_ACTION_TIMES_V --
1341 --------------------------------------
1342 PROCEDURE lock_row(
1343 p_api_version IN NUMBER,
1344 p_init_msg_list IN VARCHAR2,
1345 x_return_status OUT NOCOPY VARCHAR2,
1346 x_msg_count OUT NOCOPY NUMBER,
1347 x_msg_data OUT NOCOPY VARCHAR2,
1348 p_oks_action_times_v_rec IN oks_action_times_v_rec_type) IS
1349
1350 l_api_version CONSTANT NUMBER := 1;
1351 l_api_name CONSTANT VARCHAR2(30) := 'V_lock_row';
1352 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1353 l_oks_action_times_rec oks_action_times_rec_type;
1354 BEGIN
1355 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1356 G_PKG_NAME,
1357 p_init_msg_list,
1358 l_api_version,
1359 p_api_version,
1360 '_PVT',
1361 x_return_status);
1362 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1363 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1364 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1365 RAISE OKC_API.G_EXCEPTION_ERROR;
1366 END IF;
1367 -----------------------------------------
1368 -- Move VIEW record to "Child" records --
1369 -----------------------------------------
1370 migrate(p_oks_action_times_v_rec, l_oks_action_times_rec);
1371 ---------------------------------------------
1372 -- Call the LOCK_ROW for each child record --
1373 ---------------------------------------------
1374 lock_row(
1375 p_init_msg_list,
1376 l_return_status,
1377 x_msg_count,
1378 x_msg_data,
1379 l_oks_action_times_rec
1380 );
1381 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1382 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1383 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1384 RAISE OKC_API.G_EXCEPTION_ERROR;
1385 END IF;
1386 x_return_status := l_return_status;
1387 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1388 EXCEPTION
1389 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1390 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1391 (
1392 l_api_name,
1393 G_PKG_NAME,
1394 'OKC_API.G_RET_STS_ERROR',
1395 x_msg_count,
1396 x_msg_data,
1397 '_PVT'
1398 );
1399 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1400 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1401 (
1402 l_api_name,
1403 G_PKG_NAME,
1404 'OKC_API.G_RET_STS_UNEXP_ERROR',
1405 x_msg_count,
1406 x_msg_data,
1407 '_PVT'
1408 );
1409 WHEN OTHERS THEN
1410 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1411 (
1412 l_api_name,
1413 G_PKG_NAME,
1414 'OTHERS',
1415 x_msg_count,
1416 x_msg_data,
1417 '_PVT'
1418 );
1419 END lock_row;
1420 ----------------------------------------------------
1421 -- PL/SQL TBL lock_row for:OKS_ACTION_TIMES_V_TBL --
1422 ----------------------------------------------------
1423 PROCEDURE lock_row(
1424 p_api_version IN NUMBER,
1425 p_init_msg_list IN VARCHAR2,
1426 x_return_status OUT NOCOPY VARCHAR2,
1427 x_msg_count OUT NOCOPY NUMBER,
1428 x_msg_data OUT NOCOPY VARCHAR2,
1429 p_oks_action_times_v_tbl IN oks_action_times_v_tbl_type,
1430 px_error_tbl IN OUT NOCOPY OKC_API.ERROR_TBL_TYPE) IS
1431
1432 l_api_version CONSTANT NUMBER := 1;
1433 l_api_name CONSTANT VARCHAR2(30) := 'V_error_tbl_lock_row';
1434 i NUMBER := 0;
1435 BEGIN
1436 OKC_API.init_msg_list(p_init_msg_list);
1437 -- Make sure PL/SQL table has recrods in it before passing
1438 IF (p_oks_action_times_v_tbl.COUNT > 0) THEN
1439 i := p_oks_action_times_v_tbl.FIRST;
1440 LOOP
1441 DECLARE
1442 l_error_rec OKC_API.ERROR_REC_TYPE;
1443 BEGIN
1444 l_error_rec.api_name := l_api_name;
1445 l_error_rec.api_package := G_PKG_NAME;
1446 l_error_rec.idx := i;
1447 lock_row(
1448 p_api_version => p_api_version,
1449 p_init_msg_list => OKC_API.G_FALSE,
1450 x_return_status => l_error_rec.error_type,
1451 x_msg_count => l_error_rec.msg_count,
1452 x_msg_data => l_error_rec.msg_data,
1453 p_oks_action_times_v_rec => p_oks_action_times_v_tbl(i));
1454 IF (l_error_rec.error_type <> OKC_API.G_RET_STS_SUCCESS) THEN
1455 l_error_rec.sqlcode := SQLCODE;
1456 load_error_tbl(l_error_rec, px_error_tbl);
1457 ELSE
1458 x_msg_count := l_error_rec.msg_count;
1459 x_msg_data := l_error_rec.msg_data;
1460 END IF;
1461 EXCEPTION
1462 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1463 l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
1464 l_error_rec.sqlcode := SQLCODE;
1465 load_error_tbl(l_error_rec, px_error_tbl);
1466 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1467 l_error_rec.error_type := OKC_API.G_RET_STS_UNEXP_ERROR;
1468 l_error_rec.sqlcode := SQLCODE;
1469 load_error_tbl(l_error_rec, px_error_tbl);
1470 WHEN OTHERS THEN
1471 l_error_rec.error_type := 'OTHERS';
1472 l_error_rec.sqlcode := SQLCODE;
1473 load_error_tbl(l_error_rec, px_error_tbl);
1474 END;
1475 EXIT WHEN (i = p_oks_action_times_v_tbl.LAST);
1476 i := p_oks_action_times_v_tbl.NEXT(i);
1477 END LOOP;
1478 END IF;
1479 -- Loop through the error_tbl to find the error with the highest severity
1480 -- and return it.
1481 x_return_status := find_highest_exception(px_error_tbl);
1482 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1483 EXCEPTION
1484 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1485 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1486 (
1487 l_api_name,
1488 G_PKG_NAME,
1489 'OKC_API.G_RET_STS_ERROR',
1490 x_msg_count,
1491 x_msg_data,
1492 '_PVT'
1493 );
1494 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1495 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1496 (
1497 l_api_name,
1498 G_PKG_NAME,
1499 'OKC_API.G_RET_STS_UNEXP_ERROR',
1500 x_msg_count,
1501 x_msg_data,
1502 '_PVT'
1503 );
1504 WHEN OTHERS THEN
1505 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1506 (
1507 l_api_name,
1508 G_PKG_NAME,
1509 'OTHERS',
1510 x_msg_count,
1511 x_msg_data,
1512 '_PVT'
1513 );
1514 END lock_row;
1515 ----------------------------------------------------
1516 -- PL/SQL TBL lock_row for:OKS_ACTION_TIMES_V_TBL --
1517 ----------------------------------------------------
1518 PROCEDURE lock_row(
1519 p_api_version IN NUMBER,
1520 p_init_msg_list IN VARCHAR2,
1521 x_return_status OUT NOCOPY VARCHAR2,
1522 x_msg_count OUT NOCOPY NUMBER,
1523 x_msg_data OUT NOCOPY VARCHAR2,
1524 p_oks_action_times_v_tbl IN oks_action_times_v_tbl_type) IS
1525
1526 l_api_version CONSTANT NUMBER := 1;
1527 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_lock_row';
1528 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1529 l_error_tbl OKC_API.ERROR_TBL_TYPE;
1530 BEGIN
1531 OKC_API.init_msg_list(p_init_msg_list);
1532 -- Make sure PL/SQL table has recrods in it before passing
1533 IF (p_oks_action_times_v_tbl.COUNT > 0) THEN
1534 lock_row(
1535 p_api_version => p_api_version,
1536 p_init_msg_list => OKC_API.G_FALSE,
1537 x_return_status => x_return_status,
1538 x_msg_count => x_msg_count,
1539 x_msg_data => x_msg_data,
1540 p_oks_action_times_v_tbl => p_oks_action_times_v_tbl,
1541 px_error_tbl => l_error_tbl);
1542 END IF;
1543 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1544 EXCEPTION
1545 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1546 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1547 (
1548 l_api_name,
1549 G_PKG_NAME,
1550 'OKC_API.G_RET_STS_ERROR',
1551 x_msg_count,
1552 x_msg_data,
1553 '_PVT'
1554 );
1555 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1556 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1557 (
1558 l_api_name,
1559 G_PKG_NAME,
1560 'OKC_API.G_RET_STS_UNEXP_ERROR',
1561 x_msg_count,
1562 x_msg_data,
1563 '_PVT'
1564 );
1565 WHEN OTHERS THEN
1566 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1567 (
1568 l_api_name,
1569 G_PKG_NAME,
1570 'OTHERS',
1571 x_msg_count,
1572 x_msg_data,
1573 '_PVT'
1574 );
1575 END lock_row;
1576 ---------------------------------------------------------------------------
1577 -- PROCEDURE update_row
1578 ---------------------------------------------------------------------------
1579 -------------------------------------
1580 -- update_row for:OKS_ACTION_TIMES --
1581 -------------------------------------
1582 PROCEDURE update_row(
1583 p_init_msg_list IN VARCHAR2,
1584 x_return_status OUT NOCOPY VARCHAR2,
1585 x_msg_count OUT NOCOPY NUMBER,
1586 x_msg_data OUT NOCOPY VARCHAR2,
1587 p_oks_action_times_rec IN oks_action_times_rec_type,
1588 x_oks_action_times_rec OUT NOCOPY oks_action_times_rec_type) IS
1589
1590 l_api_version CONSTANT NUMBER := 1;
1591 l_api_name CONSTANT VARCHAR2(30) := 'B_update_row';
1592 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1593 l_oks_action_times_rec oks_action_times_rec_type := p_oks_action_times_rec;
1594 l_def_oks_action_times_rec oks_action_times_rec_type;
1595 l_row_notfound BOOLEAN := TRUE;
1596 ----------------------------------
1597 -- FUNCTION populate_new_record --
1598 ----------------------------------
1599 FUNCTION populate_new_record (
1600 p_oks_action_times_rec IN oks_action_times_rec_type,
1601 x_oks_action_times_rec OUT NOCOPY oks_action_times_rec_type
1602 ) RETURN VARCHAR2 IS
1603 l_oks_action_times_rec oks_action_times_rec_type;
1604 l_row_notfound BOOLEAN := TRUE;
1605 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1606 BEGIN
1607 x_oks_action_times_rec := p_oks_action_times_rec;
1608 -- Get current database values
1609 l_oks_action_times_rec := get_rec(p_oks_action_times_rec, l_return_status);
1610 IF (l_return_status = OKC_API.G_RET_STS_SUCCESS) THEN
1611 IF (x_oks_action_times_rec.id = OKC_API.G_MISS_NUM)
1612 THEN
1613 x_oks_action_times_rec.id := l_oks_action_times_rec.id;
1614 END IF;
1615 IF (x_oks_action_times_rec.cov_action_type_id = OKC_API.G_MISS_NUM)
1616 THEN
1617 x_oks_action_times_rec.cov_action_type_id := l_oks_action_times_rec.cov_action_type_id;
1618 END IF;
1619 IF (x_oks_action_times_rec.cle_id = OKC_API.G_MISS_NUM)
1620 THEN
1621 x_oks_action_times_rec.cle_id := l_oks_action_times_rec.cle_id;
1622 END IF;
1623 IF (x_oks_action_times_rec.dnz_chr_id = OKC_API.G_MISS_NUM)
1624 THEN
1625 x_oks_action_times_rec.dnz_chr_id := l_oks_action_times_rec.dnz_chr_id;
1626 END IF;
1627 IF (x_oks_action_times_rec.uom_code = OKC_API.G_MISS_CHAR)
1628 THEN
1629 x_oks_action_times_rec.uom_code := l_oks_action_times_rec.uom_code;
1630 END IF;
1631 IF (x_oks_action_times_rec.sun_duration = OKC_API.G_MISS_NUM)
1632 THEN
1633 x_oks_action_times_rec.sun_duration := l_oks_action_times_rec.sun_duration;
1634 END IF;
1635 IF (x_oks_action_times_rec.mon_duration = OKC_API.G_MISS_NUM)
1636 THEN
1637 x_oks_action_times_rec.mon_duration := l_oks_action_times_rec.mon_duration;
1638 END IF;
1639 IF (x_oks_action_times_rec.tue_duration = OKC_API.G_MISS_NUM)
1640 THEN
1641 x_oks_action_times_rec.tue_duration := l_oks_action_times_rec.tue_duration;
1642 END IF;
1643 IF (x_oks_action_times_rec.wed_duration = OKC_API.G_MISS_NUM)
1644 THEN
1645 x_oks_action_times_rec.wed_duration := l_oks_action_times_rec.wed_duration;
1646 END IF;
1647 IF (x_oks_action_times_rec.thu_duration = OKC_API.G_MISS_NUM)
1648 THEN
1649 x_oks_action_times_rec.thu_duration := l_oks_action_times_rec.thu_duration;
1650 END IF;
1651 IF (x_oks_action_times_rec.fri_duration = OKC_API.G_MISS_NUM)
1652 THEN
1653 x_oks_action_times_rec.fri_duration := l_oks_action_times_rec.fri_duration;
1654 END IF;
1655 IF (x_oks_action_times_rec.sat_duration = OKC_API.G_MISS_NUM)
1656 THEN
1657 x_oks_action_times_rec.sat_duration := l_oks_action_times_rec.sat_duration;
1658 END IF;
1659 IF (x_oks_action_times_rec.program_application_id = OKC_API.G_MISS_NUM)
1660 THEN
1661 x_oks_action_times_rec.program_application_id := l_oks_action_times_rec.program_application_id;
1662 END IF;
1663 IF (x_oks_action_times_rec.program_id = OKC_API.G_MISS_NUM)
1664 THEN
1665 x_oks_action_times_rec.program_id := l_oks_action_times_rec.program_id;
1666 END IF;
1667 IF (x_oks_action_times_rec.program_update_date = OKC_API.G_MISS_DATE)
1668 THEN
1669 x_oks_action_times_rec.program_update_date := l_oks_action_times_rec.program_update_date;
1670 END IF;
1671 IF (x_oks_action_times_rec.request_id = OKC_API.G_MISS_NUM)
1672 THEN
1673 x_oks_action_times_rec.request_id := l_oks_action_times_rec.request_id;
1674 END IF;
1675 IF (x_oks_action_times_rec.created_by = OKC_API.G_MISS_NUM)
1676 THEN
1677 x_oks_action_times_rec.created_by := l_oks_action_times_rec.created_by;
1678 END IF;
1679 IF (x_oks_action_times_rec.creation_date = OKC_API.G_MISS_DATE)
1680 THEN
1681 x_oks_action_times_rec.creation_date := l_oks_action_times_rec.creation_date;
1682 END IF;
1683 IF (x_oks_action_times_rec.last_updated_by = OKC_API.G_MISS_NUM)
1684 THEN
1685 x_oks_action_times_rec.last_updated_by := l_oks_action_times_rec.last_updated_by;
1686 END IF;
1687 IF (x_oks_action_times_rec.last_update_date = OKC_API.G_MISS_DATE)
1688 THEN
1689 x_oks_action_times_rec.last_update_date := l_oks_action_times_rec.last_update_date;
1690 END IF;
1691 IF (x_oks_action_times_rec.last_update_login = OKC_API.G_MISS_NUM)
1692 THEN
1693 x_oks_action_times_rec.last_update_login := l_oks_action_times_rec.last_update_login;
1694 END IF;
1695 IF (x_oks_action_times_rec.object_version_number = OKC_API.G_MISS_NUM)
1696 THEN
1697 x_oks_action_times_rec.object_version_number := l_oks_action_times_rec.object_version_number;
1698 END IF;
1699 END IF;
1700 RETURN(l_return_status);
1701 END populate_new_record;
1702 -----------------------------------------
1703 -- Set_Attributes for:OKS_ACTION_TIMES --
1704 -----------------------------------------
1705 FUNCTION Set_Attributes (
1706 p_oks_action_times_rec IN oks_action_times_rec_type,
1707 x_oks_action_times_rec OUT NOCOPY oks_action_times_rec_type
1708 ) RETURN VARCHAR2 IS
1709 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1710 BEGIN
1711 x_oks_action_times_rec := p_oks_action_times_rec;
1712 x_oks_action_times_rec.OBJECT_VERSION_NUMBER := p_oks_action_times_rec.OBJECT_VERSION_NUMBER + 1;
1713 RETURN(l_return_status);
1714 END Set_Attributes;
1715 BEGIN
1716 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1717 p_init_msg_list,
1718 '_PVT',
1719 x_return_status);
1720 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1721 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1722 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1723 RAISE OKC_API.G_EXCEPTION_ERROR;
1724 END IF;
1725 --- Setting item attributes
1726 l_return_status := Set_Attributes(
1727 p_oks_action_times_rec, -- IN
1728 l_oks_action_times_rec); -- OUT
1729 --- If any errors happen abort API
1730 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1731 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1732 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1733 RAISE OKC_API.G_EXCEPTION_ERROR;
1734 END IF;
1735 l_return_status := populate_new_record(l_oks_action_times_rec, l_def_oks_action_times_rec);
1736 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1737 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1738 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1739 RAISE OKC_API.G_EXCEPTION_ERROR;
1740 END IF;
1741 UPDATE OKS_ACTION_TIMES
1742 SET COV_ACTION_TYPE_ID = l_def_oks_action_times_rec.cov_action_type_id,
1743 CLE_ID = l_def_oks_action_times_rec.cle_id,
1744 DNZ_CHR_ID = l_def_oks_action_times_rec.dnz_chr_id,
1745 UOM_CODE = l_def_oks_action_times_rec.uom_code,
1746 SUN_DURATION = l_def_oks_action_times_rec.sun_duration,
1747 MON_DURATION = l_def_oks_action_times_rec.mon_duration,
1748 TUE_DURATION = l_def_oks_action_times_rec.tue_duration,
1749 WED_DURATION = l_def_oks_action_times_rec.wed_duration,
1750 THU_DURATION = l_def_oks_action_times_rec.thu_duration,
1751 FRI_DURATION = l_def_oks_action_times_rec.fri_duration,
1752 SAT_DURATION = l_def_oks_action_times_rec.sat_duration,
1753 PROGRAM_APPLICATION_ID = l_def_oks_action_times_rec.program_application_id,
1754 PROGRAM_ID = l_def_oks_action_times_rec.program_id,
1755 PROGRAM_UPDATE_DATE = l_def_oks_action_times_rec.program_update_date,
1756 REQUEST_ID = l_def_oks_action_times_rec.request_id,
1757 CREATED_BY = l_def_oks_action_times_rec.created_by,
1758 CREATION_DATE = l_def_oks_action_times_rec.creation_date,
1759 LAST_UPDATED_BY = l_def_oks_action_times_rec.last_updated_by,
1760 LAST_UPDATE_DATE = l_def_oks_action_times_rec.last_update_date,
1761 LAST_UPDATE_LOGIN = l_def_oks_action_times_rec.last_update_login,
1762 OBJECT_VERSION_NUMBER = l_def_oks_action_times_rec.object_version_number
1763 WHERE ID = l_def_oks_action_times_rec.id;
1764
1765 x_oks_action_times_rec := l_oks_action_times_rec;
1766 x_return_status := l_return_status;
1767 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1768 EXCEPTION
1769 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1770 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1771 (
1772 l_api_name,
1773 G_PKG_NAME,
1774 'OKC_API.G_RET_STS_ERROR',
1775 x_msg_count,
1776 x_msg_data,
1777 '_PVT'
1778 );
1779 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1780 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1781 (
1782 l_api_name,
1783 G_PKG_NAME,
1784 'OKC_API.G_RET_STS_UNEXP_ERROR',
1785 x_msg_count,
1786 x_msg_data,
1787 '_PVT'
1788 );
1789 WHEN OTHERS THEN
1790 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1791 (
1792 l_api_name,
1793 G_PKG_NAME,
1794 'OTHERS',
1795 x_msg_count,
1796 x_msg_data,
1797 '_PVT'
1798 );
1799 END update_row;
1800 ---------------------------------------
1801 -- update_row for:OKS_ACTION_TIMES_V --
1802 ---------------------------------------
1803 PROCEDURE update_row(
1804 p_api_version IN NUMBER,
1805 p_init_msg_list IN VARCHAR2,
1806 x_return_status OUT NOCOPY VARCHAR2,
1807 x_msg_count OUT NOCOPY NUMBER,
1808 x_msg_data OUT NOCOPY VARCHAR2,
1809 p_oks_action_times_v_rec IN oks_action_times_v_rec_type,
1810 x_oks_action_times_v_rec OUT NOCOPY oks_action_times_v_rec_type) IS
1811
1812 l_api_version CONSTANT NUMBER := 1;
1813 l_api_name CONSTANT VARCHAR2(30) := 'V_update_row';
1814 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1815 l_oks_action_times_v_rec oks_action_times_v_rec_type := p_oks_action_times_v_rec;
1816 l_def_oks_action_times_v_rec oks_action_times_v_rec_type;
1817 l_db_oks_action_times_v_rec oks_action_times_v_rec_type;
1818 l_oks_action_times_rec oks_action_times_rec_type;
1819 lx_oks_action_times_rec oks_action_times_rec_type;
1820 -------------------------------
1821 -- FUNCTION fill_who_columns --
1822 -------------------------------
1823 FUNCTION fill_who_columns (
1824 p_oks_action_times_v_rec IN oks_action_times_v_rec_type
1825 ) RETURN oks_action_times_v_rec_type IS
1826 l_oks_action_times_v_rec oks_action_times_v_rec_type := p_oks_action_times_v_rec;
1827 BEGIN
1828 l_oks_action_times_v_rec.LAST_UPDATE_DATE := SYSDATE;
1829 l_oks_action_times_v_rec.LAST_UPDATED_BY := FND_GLOBAL.USER_ID;
1830 l_oks_action_times_v_rec.LAST_UPDATE_LOGIN := FND_GLOBAL.LOGIN_ID;
1831 RETURN(l_oks_action_times_v_rec);
1832 END fill_who_columns;
1833 ----------------------------------
1834 -- FUNCTION populate_new_record --
1835 ----------------------------------
1836 FUNCTION populate_new_record (
1837 p_oks_action_times_v_rec IN oks_action_times_v_rec_type,
1838 x_oks_action_times_v_rec OUT NOCOPY oks_action_times_v_rec_type
1839 ) RETURN VARCHAR2 IS
1840 l_row_notfound BOOLEAN := TRUE;
1841 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1842 BEGIN
1843 x_oks_action_times_v_rec := p_oks_action_times_v_rec;
1844 -- Get current database values
1845 -- NOTE: Never assign the OBJECT_VERSION_NUMBER. Force the user to pass it
1846 -- so it may be verified through LOCK_ROW.
1847 l_db_oks_action_times_v_rec := get_rec(p_oks_action_times_v_rec, l_return_status);
1848 IF (l_return_status = OKC_API.G_RET_STS_SUCCESS) THEN
1849 IF (x_oks_action_times_v_rec.id = OKC_API.G_MISS_NUM)
1850 THEN
1851 x_oks_action_times_v_rec.id := l_db_oks_action_times_v_rec.id;
1852 END IF;
1853 IF (x_oks_action_times_v_rec.cov_action_type_id = OKC_API.G_MISS_NUM)
1854 THEN
1855 x_oks_action_times_v_rec.cov_action_type_id := l_db_oks_action_times_v_rec.cov_action_type_id;
1856 END IF;
1857 IF (x_oks_action_times_v_rec.cle_id = OKC_API.G_MISS_NUM)
1858 THEN
1859 x_oks_action_times_v_rec.cle_id := l_db_oks_action_times_v_rec.cle_id;
1860 END IF;
1861 IF (x_oks_action_times_v_rec.dnz_chr_id = OKC_API.G_MISS_NUM)
1862 THEN
1863 x_oks_action_times_v_rec.dnz_chr_id := l_db_oks_action_times_v_rec.dnz_chr_id;
1864 END IF;
1865 IF (x_oks_action_times_v_rec.uom_code = OKC_API.G_MISS_CHAR)
1866 THEN
1867 x_oks_action_times_v_rec.uom_code := l_db_oks_action_times_v_rec.uom_code;
1868 END IF;
1869 IF (x_oks_action_times_v_rec.sun_duration = OKC_API.G_MISS_NUM)
1870 THEN
1871 x_oks_action_times_v_rec.sun_duration := l_db_oks_action_times_v_rec.sun_duration;
1872 END IF;
1873 IF (x_oks_action_times_v_rec.mon_duration = OKC_API.G_MISS_NUM)
1874 THEN
1875 x_oks_action_times_v_rec.mon_duration := l_db_oks_action_times_v_rec.mon_duration;
1876 END IF;
1877 IF (x_oks_action_times_v_rec.tue_duration = OKC_API.G_MISS_NUM)
1878 THEN
1879 x_oks_action_times_v_rec.tue_duration := l_db_oks_action_times_v_rec.tue_duration;
1880 END IF;
1881 IF (x_oks_action_times_v_rec.wed_duration = OKC_API.G_MISS_NUM)
1882 THEN
1883 x_oks_action_times_v_rec.wed_duration := l_db_oks_action_times_v_rec.wed_duration;
1884 END IF;
1885 IF (x_oks_action_times_v_rec.thu_duration = OKC_API.G_MISS_NUM)
1886 THEN
1887 x_oks_action_times_v_rec.thu_duration := l_db_oks_action_times_v_rec.thu_duration;
1888 END IF;
1889 IF (x_oks_action_times_v_rec.fri_duration = OKC_API.G_MISS_NUM)
1890 THEN
1891 x_oks_action_times_v_rec.fri_duration := l_db_oks_action_times_v_rec.fri_duration;
1892 END IF;
1893 IF (x_oks_action_times_v_rec.sat_duration = OKC_API.G_MISS_NUM)
1894 THEN
1895 x_oks_action_times_v_rec.sat_duration := l_db_oks_action_times_v_rec.sat_duration;
1896 END IF;
1897 IF (x_oks_action_times_v_rec.security_group_id = OKC_API.G_MISS_NUM)
1898 THEN
1899 x_oks_action_times_v_rec.security_group_id := l_db_oks_action_times_v_rec.security_group_id;
1900 END IF;
1901 IF (x_oks_action_times_v_rec.program_application_id = OKC_API.G_MISS_NUM)
1902 THEN
1903 x_oks_action_times_v_rec.program_application_id := l_db_oks_action_times_v_rec.program_application_id;
1904 END IF;
1905 IF (x_oks_action_times_v_rec.program_id = OKC_API.G_MISS_NUM)
1906 THEN
1907 x_oks_action_times_v_rec.program_id := l_db_oks_action_times_v_rec.program_id;
1908 END IF;
1909 IF (x_oks_action_times_v_rec.program_update_date = OKC_API.G_MISS_DATE)
1910 THEN
1911 x_oks_action_times_v_rec.program_update_date := l_db_oks_action_times_v_rec.program_update_date;
1912 END IF;
1913 IF (x_oks_action_times_v_rec.request_id = OKC_API.G_MISS_NUM)
1914 THEN
1915 x_oks_action_times_v_rec.request_id := l_db_oks_action_times_v_rec.request_id;
1916 END IF;
1917 IF (x_oks_action_times_v_rec.created_by = OKC_API.G_MISS_NUM)
1918 THEN
1919 x_oks_action_times_v_rec.created_by := l_db_oks_action_times_v_rec.created_by;
1920 END IF;
1921 IF (x_oks_action_times_v_rec.creation_date = OKC_API.G_MISS_DATE)
1922 THEN
1923 x_oks_action_times_v_rec.creation_date := l_db_oks_action_times_v_rec.creation_date;
1924 END IF;
1925 IF (x_oks_action_times_v_rec.last_updated_by = OKC_API.G_MISS_NUM)
1926 THEN
1927 x_oks_action_times_v_rec.last_updated_by := l_db_oks_action_times_v_rec.last_updated_by;
1928 END IF;
1929 IF (x_oks_action_times_v_rec.last_update_date = OKC_API.G_MISS_DATE)
1930 THEN
1931 x_oks_action_times_v_rec.last_update_date := l_db_oks_action_times_v_rec.last_update_date;
1932 END IF;
1933 IF (x_oks_action_times_v_rec.last_update_login = OKC_API.G_MISS_NUM)
1934 THEN
1935 x_oks_action_times_v_rec.last_update_login := l_db_oks_action_times_v_rec.last_update_login;
1936 END IF;
1937 END IF;
1938 RETURN(l_return_status);
1939 END populate_new_record;
1940 -------------------------------------------
1941 -- Set_Attributes for:OKS_ACTION_TIMES_V --
1942 -------------------------------------------
1943 FUNCTION Set_Attributes (
1944 p_oks_action_times_v_rec IN oks_action_times_v_rec_type,
1945 x_oks_action_times_v_rec OUT NOCOPY oks_action_times_v_rec_type
1946 ) RETURN VARCHAR2 IS
1947 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1948 BEGIN
1949 x_oks_action_times_v_rec := p_oks_action_times_v_rec;
1950 RETURN(l_return_status);
1951 END Set_Attributes;
1952 BEGIN
1953 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1954 G_PKG_NAME,
1955 p_init_msg_list,
1956 l_api_version,
1957 p_api_version,
1958 '_PVT',
1959 x_return_status);
1960 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1961 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1962 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1963 RAISE OKC_API.G_EXCEPTION_ERROR;
1964 END IF;
1965 --- Setting item attributes
1966 l_return_status := Set_Attributes(
1967 p_oks_action_times_v_rec, -- IN
1968 x_oks_action_times_v_rec); -- OUT
1969 --- If any errors happen abort API
1970 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1971 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1972 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1973 RAISE OKC_API.G_EXCEPTION_ERROR;
1974 END IF;
1975 l_return_status := populate_new_record(l_oks_action_times_v_rec, l_def_oks_action_times_v_rec);
1976 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1977 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1978 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1979 RAISE OKC_API.G_EXCEPTION_ERROR;
1980 END IF;
1981 l_def_oks_action_times_v_rec := fill_who_columns(l_def_oks_action_times_v_rec);
1982 --- Validate all non-missing attributes (Item Level Validation)
1983 l_return_status := Validate_Attributes(l_def_oks_action_times_v_rec);
1984 --- If any errors happen abort API
1985 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1986 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1987 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1988 RAISE OKC_API.G_EXCEPTION_ERROR;
1989 END IF;
1990 l_return_status := Validate_Record(l_def_oks_action_times_v_rec, l_db_oks_action_times_v_rec);
1991 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1992 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1993 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1994 RAISE OKC_API.G_EXCEPTION_ERROR;
1995 END IF;
1996
1997 -- Lock the Record
1998 lock_row(
1999 p_api_version => p_api_version,
2000 p_init_msg_list => p_init_msg_list,
2001 x_return_status => l_return_status,
2002 x_msg_count => x_msg_count,
2003 x_msg_data => x_msg_data,
2004 p_oks_action_times_v_rec => p_oks_action_times_v_rec);
2005 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2006 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2007 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2008 RAISE OKC_API.G_EXCEPTION_ERROR;
2009 END IF;
2010
2011 -----------------------------------------
2012 -- Move VIEW record to "Child" records --
2013 -----------------------------------------
2014 migrate(l_def_oks_action_times_v_rec, l_oks_action_times_rec);
2015 -----------------------------------------------
2016 -- Call the UPDATE_ROW for each child record --
2017 -----------------------------------------------
2018 update_row(
2019 p_init_msg_list,
2020 l_return_status,
2021 x_msg_count,
2022 x_msg_data,
2023 l_oks_action_times_rec,
2024 lx_oks_action_times_rec
2025 );
2026 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2027 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2028 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2029 RAISE OKC_API.G_EXCEPTION_ERROR;
2030 END IF;
2031 migrate(lx_oks_action_times_rec, l_def_oks_action_times_v_rec);
2032 x_oks_action_times_v_rec := l_def_oks_action_times_v_rec;
2033 x_return_status := l_return_status;
2034 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2035 EXCEPTION
2036 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2037 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2038 (
2039 l_api_name,
2040 G_PKG_NAME,
2041 'OKC_API.G_RET_STS_ERROR',
2042 x_msg_count,
2043 x_msg_data,
2044 '_PVT'
2045 );
2046 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2047 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2048 (
2049 l_api_name,
2050 G_PKG_NAME,
2051 'OKC_API.G_RET_STS_UNEXP_ERROR',
2052 x_msg_count,
2053 x_msg_data,
2054 '_PVT'
2055 );
2056 WHEN OTHERS THEN
2057 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2058 (
2059 l_api_name,
2060 G_PKG_NAME,
2061 'OTHERS',
2062 x_msg_count,
2063 x_msg_data,
2064 '_PVT'
2065 );
2066 END update_row;
2067 ------------------------------------------------------
2068 -- PL/SQL TBL update_row for:oks_action_times_v_tbl --
2069 ------------------------------------------------------
2070 PROCEDURE update_row(
2071 p_api_version IN NUMBER,
2072 p_init_msg_list IN VARCHAR2,
2073 x_return_status OUT NOCOPY VARCHAR2,
2074 x_msg_count OUT NOCOPY NUMBER,
2075 x_msg_data OUT NOCOPY VARCHAR2,
2076 p_oks_action_times_v_tbl IN oks_action_times_v_tbl_type,
2077 x_oks_action_times_v_tbl OUT NOCOPY oks_action_times_v_tbl_type,
2078 px_error_tbl IN OUT NOCOPY OKC_API.ERROR_TBL_TYPE) IS
2079
2080 l_api_version CONSTANT NUMBER := 1;
2081 l_api_name CONSTANT VARCHAR2(30) := 'V_error_tbl_update_row';
2082 i NUMBER := 0;
2083 BEGIN
2084 OKC_API.init_msg_list(p_init_msg_list);
2085 -- Make sure PL/SQL table has records in it before passing
2086 IF (p_oks_action_times_v_tbl.COUNT > 0) THEN
2087 i := p_oks_action_times_v_tbl.FIRST;
2088 LOOP
2089 DECLARE
2090 l_error_rec OKC_API.ERROR_REC_TYPE;
2091 BEGIN
2092 l_error_rec.api_name := l_api_name;
2093 l_error_rec.api_package := G_PKG_NAME;
2094 l_error_rec.idx := i;
2095 update_row (
2096 p_api_version => p_api_version,
2097 p_init_msg_list => OKC_API.G_FALSE,
2098 x_return_status => l_error_rec.error_type,
2099 x_msg_count => l_error_rec.msg_count,
2100 x_msg_data => l_error_rec.msg_data,
2101 p_oks_action_times_v_rec => p_oks_action_times_v_tbl(i),
2102 x_oks_action_times_v_rec => x_oks_action_times_v_tbl(i));
2103 IF (l_error_rec.error_type <> OKC_API.G_RET_STS_SUCCESS) THEN
2104 l_error_rec.sqlcode := SQLCODE;
2105 load_error_tbl(l_error_rec, px_error_tbl);
2106 ELSE
2107 x_msg_count := l_error_rec.msg_count;
2108 x_msg_data := l_error_rec.msg_data;
2109 END IF;
2110 EXCEPTION
2111 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2112 l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
2113 l_error_rec.sqlcode := SQLCODE;
2114 load_error_tbl(l_error_rec, px_error_tbl);
2115 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2116 l_error_rec.error_type := OKC_API.G_RET_STS_UNEXP_ERROR;
2117 l_error_rec.sqlcode := SQLCODE;
2118 load_error_tbl(l_error_rec, px_error_tbl);
2119 WHEN OTHERS THEN
2120 l_error_rec.error_type := 'OTHERS';
2121 l_error_rec.sqlcode := SQLCODE;
2122 load_error_tbl(l_error_rec, px_error_tbl);
2123 END;
2124 EXIT WHEN (i = p_oks_action_times_v_tbl.LAST);
2125 i := p_oks_action_times_v_tbl.NEXT(i);
2126 END LOOP;
2127 END IF;
2128 -- Loop through the error_tbl to find the error with the highest severity
2129 -- and return it.
2130 x_return_status := find_highest_exception(px_error_tbl);
2131 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2132 EXCEPTION
2133 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2134 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2135 (
2136 l_api_name,
2137 G_PKG_NAME,
2138 'OKC_API.G_RET_STS_ERROR',
2139 x_msg_count,
2140 x_msg_data,
2141 '_PVT'
2142 );
2143 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2144 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2145 (
2146 l_api_name,
2147 G_PKG_NAME,
2148 'OKC_API.G_RET_STS_UNEXP_ERROR',
2149 x_msg_count,
2150 x_msg_data,
2151 '_PVT'
2152 );
2153 WHEN OTHERS THEN
2154 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2155 (
2156 l_api_name,
2157 G_PKG_NAME,
2158 'OTHERS',
2159 x_msg_count,
2160 x_msg_data,
2161 '_PVT'
2162 );
2163 END update_row;
2164
2165 ------------------------------------------------------
2166 -- PL/SQL TBL update_row for:OKS_ACTION_TIMES_V_TBL --
2167 ------------------------------------------------------
2168 -- This procedure is the same as the one above except it does not have a "px_error_tbl" argument.
2169 -- This procedure was create for backward compatibility and simply is a wrapper for the one above.
2170 PROCEDURE update_row(
2171 p_api_version IN NUMBER,
2172 p_init_msg_list IN VARCHAR2,
2173 x_return_status OUT NOCOPY VARCHAR2,
2174 x_msg_count OUT NOCOPY NUMBER,
2175 x_msg_data OUT NOCOPY VARCHAR2,
2176 p_oks_action_times_v_tbl IN oks_action_times_v_tbl_type,
2177 x_oks_action_times_v_tbl OUT NOCOPY oks_action_times_v_tbl_type) IS
2178
2179 l_api_version CONSTANT NUMBER := 1;
2180 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_update_row';
2181 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2182 l_error_tbl OKC_API.ERROR_TBL_TYPE;
2183 BEGIN
2184 OKC_API.init_msg_list(p_init_msg_list);
2185 -- Make sure PL/SQL table has records in it before passing
2186 IF (p_oks_action_times_v_tbl.COUNT > 0) THEN
2187 update_row (
2188 p_api_version => p_api_version,
2189 p_init_msg_list => OKC_API.G_FALSE,
2190 x_return_status => x_return_status,
2191 x_msg_count => x_msg_count,
2192 x_msg_data => x_msg_data,
2193 p_oks_action_times_v_tbl => p_oks_action_times_v_tbl,
2194 x_oks_action_times_v_tbl => x_oks_action_times_v_tbl,
2195 px_error_tbl => l_error_tbl);
2196 END IF;
2197 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2198 EXCEPTION
2199 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2200 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2201 (
2202 l_api_name,
2203 G_PKG_NAME,
2204 'OKC_API.G_RET_STS_ERROR',
2205 x_msg_count,
2206 x_msg_data,
2207 '_PVT'
2208 );
2209 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2210 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2211 (
2212 l_api_name,
2213 G_PKG_NAME,
2214 'OKC_API.G_RET_STS_UNEXP_ERROR',
2215 x_msg_count,
2216 x_msg_data,
2217 '_PVT'
2218 );
2219 WHEN OTHERS THEN
2220 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2221 (
2222 l_api_name,
2223 G_PKG_NAME,
2224 'OTHERS',
2225 x_msg_count,
2226 x_msg_data,
2227 '_PVT'
2228 );
2229 END update_row;
2230
2231 ---------------------------------------------------------------------------
2232 -- PROCEDURE delete_row
2233 ---------------------------------------------------------------------------
2234 -------------------------------------
2235 -- delete_row for:OKS_ACTION_TIMES --
2236 -------------------------------------
2237 PROCEDURE delete_row(
2238 p_init_msg_list IN VARCHAR2,
2239 x_return_status OUT NOCOPY VARCHAR2,
2240 x_msg_count OUT NOCOPY NUMBER,
2241 x_msg_data OUT NOCOPY VARCHAR2,
2242 p_oks_action_times_rec IN oks_action_times_rec_type) IS
2243
2244 l_api_version CONSTANT NUMBER := 1;
2245 l_api_name CONSTANT VARCHAR2(30) := 'B_delete_row';
2246 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2247 l_oks_action_times_rec oks_action_times_rec_type := p_oks_action_times_rec;
2248 l_row_notfound BOOLEAN := TRUE;
2249 BEGIN
2250 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2251 p_init_msg_list,
2252 '_PVT',
2253 x_return_status);
2254 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2255 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2256 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2257 RAISE OKC_API.G_EXCEPTION_ERROR;
2258 END IF;
2259
2260 DELETE FROM OKS_ACTION_TIMES
2261 WHERE ID = p_oks_action_times_rec.id;
2262
2263 x_return_status := l_return_status;
2264 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2265 EXCEPTION
2266 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2267 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2268 (
2269 l_api_name,
2270 G_PKG_NAME,
2271 'OKC_API.G_RET_STS_ERROR',
2272 x_msg_count,
2273 x_msg_data,
2274 '_PVT'
2275 );
2276 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2277 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2278 (
2279 l_api_name,
2280 G_PKG_NAME,
2281 'OKC_API.G_RET_STS_UNEXP_ERROR',
2282 x_msg_count,
2283 x_msg_data,
2284 '_PVT'
2285 );
2286 WHEN OTHERS THEN
2287 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2288 (
2289 l_api_name,
2290 G_PKG_NAME,
2291 'OTHERS',
2292 x_msg_count,
2293 x_msg_data,
2294 '_PVT'
2295 );
2296 END delete_row;
2297 ---------------------------------------
2298 -- delete_row for:OKS_ACTION_TIMES_V --
2299 ---------------------------------------
2300 PROCEDURE delete_row(
2301 p_api_version IN NUMBER,
2302 p_init_msg_list IN VARCHAR2,
2303 x_return_status OUT NOCOPY VARCHAR2,
2304 x_msg_count OUT NOCOPY NUMBER,
2305 x_msg_data OUT NOCOPY VARCHAR2,
2306 p_oks_action_times_v_rec IN oks_action_times_v_rec_type) IS
2307
2308 l_api_version CONSTANT NUMBER := 1;
2309 l_api_name CONSTANT VARCHAR2(30) := 'V_delete_row';
2310 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2311 l_oks_action_times_v_rec oks_action_times_v_rec_type := p_oks_action_times_v_rec;
2312 l_oks_action_times_rec oks_action_times_rec_type;
2313 BEGIN
2314 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2315 G_PKG_NAME,
2316 p_init_msg_list,
2317 l_api_version,
2318 p_api_version,
2319 '_PVT',
2320 x_return_status);
2321 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2322 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2323 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2324 RAISE OKC_API.G_EXCEPTION_ERROR;
2325 END IF;
2326 -----------------------------------------
2327 -- Move VIEW record to "Child" records --
2328 -----------------------------------------
2329 migrate(l_oks_action_times_v_rec, l_oks_action_times_rec);
2330 -----------------------------------------------
2331 -- Call the DELETE_ROW for each child record --
2332 -----------------------------------------------
2333 delete_row(
2334 p_init_msg_list,
2335 l_return_status,
2336 x_msg_count,
2337 x_msg_data,
2338 l_oks_action_times_rec
2339 );
2340 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2341 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2342 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2343 RAISE OKC_API.G_EXCEPTION_ERROR;
2344 END IF;
2345 x_return_status := l_return_status;
2346 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2347 EXCEPTION
2348 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2349 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2350 (
2351 l_api_name,
2352 G_PKG_NAME,
2353 'OKC_API.G_RET_STS_ERROR',
2354 x_msg_count,
2355 x_msg_data,
2356 '_PVT'
2357 );
2358 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2359 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2360 (
2361 l_api_name,
2362 G_PKG_NAME,
2363 'OKC_API.G_RET_STS_UNEXP_ERROR',
2364 x_msg_count,
2365 x_msg_data,
2366 '_PVT'
2367 );
2368 WHEN OTHERS THEN
2369 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2370 (
2371 l_api_name,
2372 G_PKG_NAME,
2373 'OTHERS',
2374 x_msg_count,
2375 x_msg_data,
2376 '_PVT'
2377 );
2378 END delete_row;
2379 --------------------------------------------------
2380 -- PL/SQL TBL delete_row for:OKS_ACTION_TIMES_V --
2381 --------------------------------------------------
2382 PROCEDURE delete_row(
2383 p_api_version IN NUMBER,
2384 p_init_msg_list IN VARCHAR2,
2385 x_return_status OUT NOCOPY VARCHAR2,
2386 x_msg_count OUT NOCOPY NUMBER,
2387 x_msg_data OUT NOCOPY VARCHAR2,
2388 p_oks_action_times_v_tbl IN oks_action_times_v_tbl_type,
2389 px_error_tbl IN OUT NOCOPY OKC_API.ERROR_TBL_TYPE) IS
2390
2391 l_api_version CONSTANT NUMBER := 1;
2392 l_api_name CONSTANT VARCHAR2(30) := 'V_error_tbl_delete_row';
2393 i NUMBER := 0;
2394 BEGIN
2395 OKC_API.init_msg_list(p_init_msg_list);
2396 -- Make sure PL/SQL table has records in it before passing
2397 IF (p_oks_action_times_v_tbl.COUNT > 0) THEN
2398 i := p_oks_action_times_v_tbl.FIRST;
2399 LOOP
2400 DECLARE
2401 l_error_rec OKC_API.ERROR_REC_TYPE;
2402 BEGIN
2403 l_error_rec.api_name := l_api_name;
2404 l_error_rec.api_package := G_PKG_NAME;
2405 l_error_rec.idx := i;
2406 delete_row (
2407 p_api_version => p_api_version,
2408 p_init_msg_list => OKC_API.G_FALSE,
2409 x_return_status => l_error_rec.error_type,
2410 x_msg_count => l_error_rec.msg_count,
2411 x_msg_data => l_error_rec.msg_data,
2412 p_oks_action_times_v_rec => p_oks_action_times_v_tbl(i));
2413 IF (l_error_rec.error_type <> OKC_API.G_RET_STS_SUCCESS) THEN
2414 l_error_rec.sqlcode := SQLCODE;
2415 load_error_tbl(l_error_rec, px_error_tbl);
2416 ELSE
2417 x_msg_count := l_error_rec.msg_count;
2418 x_msg_data := l_error_rec.msg_data;
2419 END IF;
2420 EXCEPTION
2421 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2422 l_error_rec.error_type := OKC_API.G_RET_STS_ERROR;
2423 l_error_rec.sqlcode := SQLCODE;
2424 load_error_tbl(l_error_rec, px_error_tbl);
2425 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2426 l_error_rec.error_type := OKC_API.G_RET_STS_UNEXP_ERROR;
2427 l_error_rec.sqlcode := SQLCODE;
2428 load_error_tbl(l_error_rec, px_error_tbl);
2429 WHEN OTHERS THEN
2430 l_error_rec.error_type := 'OTHERS';
2431 l_error_rec.sqlcode := SQLCODE;
2432 load_error_tbl(l_error_rec, px_error_tbl);
2433 END;
2434 EXIT WHEN (i = p_oks_action_times_v_tbl.LAST);
2435 i := p_oks_action_times_v_tbl.NEXT(i);
2436 END LOOP;
2437 END IF;
2438 -- Loop through the error_tbl to find the error with the highest severity
2439 -- and return it.
2440 x_return_status := find_highest_exception(px_error_tbl);
2441 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2442 EXCEPTION
2443 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2444 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2445 (
2446 l_api_name,
2447 G_PKG_NAME,
2448 'OKC_API.G_RET_STS_ERROR',
2449 x_msg_count,
2450 x_msg_data,
2451 '_PVT'
2452 );
2453 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2454 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2455 (
2456 l_api_name,
2457 G_PKG_NAME,
2458 'OKC_API.G_RET_STS_UNEXP_ERROR',
2459 x_msg_count,
2460 x_msg_data,
2461 '_PVT'
2462 );
2463 WHEN OTHERS THEN
2464 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2465 (
2466 l_api_name,
2467 G_PKG_NAME,
2468 'OTHERS',
2469 x_msg_count,
2470 x_msg_data,
2471 '_PVT'
2472 );
2473 END delete_row;
2474
2475 --------------------------------------------------
2476 -- PL/SQL TBL delete_row for:OKS_ACTION_TIMES_V --
2477 --------------------------------------------------
2478 PROCEDURE delete_row(
2479 p_api_version IN NUMBER,
2480 p_init_msg_list IN VARCHAR2,
2481 x_return_status OUT NOCOPY VARCHAR2,
2482 x_msg_count OUT NOCOPY NUMBER,
2483 x_msg_data OUT NOCOPY VARCHAR2,
2484 p_oks_action_times_v_tbl IN oks_action_times_v_tbl_type) IS
2485
2486 l_api_version CONSTANT NUMBER := 1;
2487 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_delete_row';
2488 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2489 l_error_tbl OKC_API.ERROR_TBL_TYPE;
2490 BEGIN
2491 OKC_API.init_msg_list(p_init_msg_list);
2492 -- Make sure PL/SQL table has records in it before passing
2493 IF (p_oks_action_times_v_tbl.COUNT > 0) THEN
2494 delete_row (
2495 p_api_version => p_api_version,
2496 p_init_msg_list => OKC_API.G_FALSE,
2497 x_return_status => x_return_status,
2498 x_msg_count => x_msg_count,
2499 x_msg_data => x_msg_data,
2500 p_oks_action_times_v_tbl => p_oks_action_times_v_tbl,
2501 px_error_tbl => l_error_tbl);
2502 END IF;
2503 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2504 EXCEPTION
2505 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2506 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2507 (
2508 l_api_name,
2509 G_PKG_NAME,
2510 'OKC_API.G_RET_STS_ERROR',
2511 x_msg_count,
2512 x_msg_data,
2513 '_PVT'
2514 );
2515 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2516 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2517 (
2518 l_api_name,
2519 G_PKG_NAME,
2520 'OKC_API.G_RET_STS_UNEXP_ERROR',
2521 x_msg_count,
2522 x_msg_data,
2523 '_PVT'
2524 );
2525 WHEN OTHERS THEN
2526 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2527 (
2528 l_api_name,
2529 G_PKG_NAME,
2530 'OTHERS',
2531 x_msg_count,
2532 x_msg_data,
2533 '_PVT'
2534 );
2535 END delete_row;
2536
2537
2538 FUNCTION Create_Version(
2539 p_id IN NUMBER,
2540 p_major_version IN NUMBER) RETURN VARCHAR2 IS
2541
2542 l_return_status VARCHAR2(1):= OKC_API.G_RET_STS_SUCCESS;
2543 l_debug VARCHAR2(1) := NVL(FND_PROFILE.VALUE('AFLOG_ENABLED'),'N');
2544
2545 BEGIN
2546 IF (l_debug = 'Y') THEN
2547 okc_debug.Set_Indentation('OKS_ACM_PVT');
2548 okc_debug.log('23700: Entered create_version', 2);
2549 END IF;
2550
2551 INSERT INTO OKS_ACTION_TIMES_H(
2552 ID,
2553 COV_ACTION_TYPE_ID,
2554 CLE_ID,
2555 DNZ_CHR_ID,
2556 UOM_CODE,
2557 SUN_DURATION,
2558 MON_DURATION,
2559 TUE_DURATION,
2560 WED_DURATION,
2561 THU_DURATION,
2562 FRI_DURATION,
2563 SAT_DURATION,
2564 SECURITY_GROUP_ID,
2565 PROGRAM_APPLICATION_ID,
2566 PROGRAM_ID,
2567 PROGRAM_UPDATE_DATE,
2568 REQUEST_ID,
2569 CREATED_BY,
2570 CREATION_DATE,
2571 LAST_UPDATED_BY,
2572 LAST_UPDATE_DATE,
2573 LAST_UPDATE_LOGIN,
2574 OBJECT_VERSION_NUMBER,
2575 MAJOR_VERSION)
2576 SELECT
2577 ID,
2578 COV_ACTION_TYPE_ID,
2579 CLE_ID,
2580 DNZ_CHR_ID,
2581 UOM_CODE,
2582 SUN_DURATION,
2583 MON_DURATION,
2584 TUE_DURATION,
2585 WED_DURATION,
2586 THU_DURATION,
2587 FRI_DURATION,
2588 SAT_DURATION,
2589 SECURITY_GROUP_ID,
2590 PROGRAM_APPLICATION_ID,
2591 PROGRAM_ID,
2592 PROGRAM_UPDATE_DATE,
2593 REQUEST_ID,
2594 CREATED_BY,
2595 CREATION_DATE,
2596 LAST_UPDATED_BY,
2597 LAST_UPDATE_DATE,
2598 LAST_UPDATE_LOGIN,
2599 OBJECT_VERSION_NUMBER,
2600 p_major_version
2601 FROM OKS_ACTION_TIMES
2602 WHERE DNZ_CHR_ID = P_Id;
2603
2604 RETURN l_return_status;
2605
2606 IF (l_debug = 'Y') THEN
2607 okc_debug.log('23800: Exiting create_version', 2);
2608 END IF;
2609
2610 EXCEPTION
2611 WHEN OTHERS THEN
2612 IF (l_debug = 'Y') THEN
2613 okc_debug.log('23900: Exiting create_version:OTHERS Exception', 2);
2614 okc_debug.Reset_Indentation;
2615 END IF;
2616
2617 OKC_API.SET_MESSAGE(p_app_name => okc_version_pvt.G_APP_NAME,
2618 p_msg_name => okc_version_pvt.G_UNEXPECTED_ERROR,
2619 p_token1 => okc_version_pvt.G_SQLCODE_TOKEN,
2620 p_token1_value => sqlcode,
2621 p_token2 => okc_version_pvt.G_SQLERRM_TOKEN,
2622 p_token2_value => sqlerrm);
2623
2624 l_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
2625 return l_return_status;
2626 END Create_Version;
2627
2628 FUNCTION Restore_Version(
2629 p_id IN NUMBER,
2630 p_major_version IN NUMBER) RETURN VARCHAR2 IS
2631
2632 l_return_status VARCHAR2(1):= OKC_API.G_RET_STS_SUCCESS;
2633 l_debug VARCHAR2(1) := NVL(FND_PROFILE.VALUE('AFLOG_ENABLED'),'N');
2634
2635 BEGIN
2636 IF (l_debug = 'Y') THEN
2637 okc_debug.Set_Indentation('OKS_ACM_PVT');
2638 okc_debug.log('24000: Exiting restore_version:OTHERS Exception', 2);
2639 END IF;
2640
2641 DELETE OKS_ACTION_TIMES
2642 WHERE DNZ_CHR_ID = p_id;
2643
2644 INSERT INTO OKS_ACTION_TIMES(
2645 ID,
2646 COV_ACTION_TYPE_ID,
2647 CLE_ID,
2648 DNZ_CHR_ID,
2649 UOM_CODE,
2650 SUN_DURATION,
2651 MON_DURATION,
2652 TUE_DURATION,
2653 WED_DURATION,
2654 THU_DURATION,
2655 FRI_DURATION,
2656 SAT_DURATION,
2657 SECURITY_GROUP_ID,
2658 PROGRAM_APPLICATION_ID,
2659 PROGRAM_ID,
2660 PROGRAM_UPDATE_DATE,
2661 REQUEST_ID,
2662 CREATED_BY,
2663 CREATION_DATE,
2664 LAST_UPDATED_BY,
2665 LAST_UPDATE_DATE,
2666 LAST_UPDATE_LOGIN,
2667 OBJECT_VERSION_NUMBER)
2668 SELECT
2669 ID,
2670 COV_ACTION_TYPE_ID,
2671 CLE_ID,
2672 DNZ_CHR_ID,
2673 UOM_CODE,
2674 SUN_DURATION,
2675 MON_DURATION,
2676 TUE_DURATION,
2677 WED_DURATION,
2678 THU_DURATION,
2679 FRI_DURATION,
2680 SAT_DURATION,
2681 SECURITY_GROUP_ID,
2682 PROGRAM_APPLICATION_ID,
2683 PROGRAM_ID,
2684 PROGRAM_UPDATE_DATE,
2685 REQUEST_ID,
2686 CREATED_BY,
2687 CREATION_DATE,
2688 LAST_UPDATED_BY,
2689 LAST_UPDATE_DATE,
2690 LAST_UPDATE_LOGIN,
2691 OBJECT_VERSION_NUMBER
2692 FROM OKS_ACTION_TIMES_H
2693 WHERE DNZ_CHR_ID = P_Id
2694 AND major_version = p_major_version;
2695
2696 RETURN l_return_status;
2697
2698 IF (l_debug = 'Y') THEN
2699 okc_debug.log('24100: Exiting restore_version:OTHERS Exception', 2);
2700 END IF;
2701
2702 EXCEPTION
2703
2704 WHEN OTHERS THEN
2705
2706 IF (l_debug = 'Y') THEN
2707 okc_debug.log('24200: Exiting restore_version:OTHERS Exception', 2);
2708 okc_debug.Reset_Indentation;
2709 END IF;
2710
2711 OKC_API.SET_MESSAGE(p_app_name => okc_version_pvt.G_APP_NAME,
2712 p_msg_name => okc_version_pvt.G_UNEXPECTED_ERROR,
2713 p_token1 => okc_version_pvt.G_SQLCODE_TOKEN,
2714 p_token1_value => sqlcode,
2715 p_token2 => okc_version_pvt.G_SQLERRM_TOKEN,
2716 p_token2_value => sqlerrm);
2717
2718 l_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
2719
2720 return l_return_status;
2721
2722 END Restore_Version;
2723
2724
2725 END OKS_ACM_PVT;