DBA Data[Home] [Help]

PACKAGE BODY: APPS.GMI_VALID_GRP

Source


1 PACKAGE BODY GMI_VALID_GRP AS
2 -- $Header: GMIGVALB.pls 115.4 99/08/23 07:38:20 porting shi $
3 -- Body start of comments
4 --+==========================================================================+
5 --|                   Copyright (c) 1998 Oracle Corporation                  |
6 --|                          Redwood Shores, CA, USA                         |
7 --|                            All rights reserved.                          |
8 --+==========================================================================+
9 --|  FILE NAME                                                               |
10 --|       GMIGVALB.pls                                                       |
11 --|                                                                          |
12 --|  PACKAGE NAME                                                            |
13 --|       GMI_VALID_GRP                                                      |
14 --|                                                                          |
15 --|  DESCRIPTION                                                             |
16 --|       This package defines all validation functions that are used by the |
17 --|       Inventory APIs.                                                    |
18 --|                                                                          |
19 --|  CONTENTS                                                                |
20 --|       Validate_item_existance                                            |
21 --|       Validate_dualum_ind                                                |
22 --|       Validate_item_um2                                                  |
23 --|       Validate_deviation                                                 |
24 --|       Validate_deviation                                                 |
25 --|       Validate_lot_ctl                                                   |
26 --|       Validate_lot_indivisible                                           |
27 --|       Validate_sublot_ctl                                                |
28 --|       Validate_loct_ctl                                                  |
29 --|       Validate_noninv_ind                                                |
30 --|       Validate_match_type                                                |
31 --|       Validate_inactive_ind                                              |
32 --|       Validate_inv_type                                                  |
33 --|       Validate_shelf_life                                                |
34 --|       Validate_retest_interval                                           |
35 --|       Validate_item_abccode                                              |
36 --|       Validate_gl_class                                                  |
37 --|       Validate_inv_class                                                 |
38 --|       Validate_sales_class                                               |
39 --|       Validate_ship_class                                                |
40 --|       Validate_frt_class                                                 |
41 --|       Validate_price_class                                               |
42 --|       Validate_storage_class                                             |
43 --|       Validate_purch_class                                               |
44 --|       Validate_tax_class                                                 |
45 --|       Validate_customs_class                                             |
46 --|       Validate_alloc_class                                               |
47 --|       Validate_planning_class                                            |
48 --|       Validate_itemcost_class                                            |
49 --|       Validate_cost_mthd_code                                            |
50 --|       Validate_grade_ctl                                                 |
51 --|       Validate_status_ctl                                                |
52 --|       Validate_qc_grade                                                  |
53 --|       Validate_lot_status                                                |
54 --|       Validate_qchold_res_code                                           |
55 --|       Validate_expaction_code                                            |
56 --|       Validate_expaction_interval                                        |
57 --|       Validate_experimental_ind                                          |
58 --|       Validate_seq_dpnd_class                                            |
59 --|       Validate_commodity_code                                            |
60 --|       Validate_ic_matr_days                                              |
61 --|       Validate_ic_hold_days                                              |
62 --|       Validate_Strength                                                  |
63 --|       Validate_origination_type                                          |
64 --|       Validate_shipvendor_no                                             |
65 --|       Validate_lot_no                                                    |
66 --|       Validate_location                                                  |
67 --|       Validate_item_cnv                                                  |
68 --|                                                                          |
69 --|  HISTORY                                                                 |
70 --|       11/13/1998 Mike Godfrey - Created                                  |
71 --|       16/AUG/99  Bug 965832(1)Errors on status_ctl/lot status combina -  |
72 --|                  tions                                                   |
73 --|       20/AUG/99  Bug 951828 Change GMS package Calls to GMA              |
74 --|                  H.Verdding                                              |
75 --|                                                                          |
76 --+==========================================================================+
77 -- Func end of comments
78 
79 -- Func start of comments
80 --+==========================================================================+
81 --|  FUNCTION NAME                                                           |
82 --|       Validate_item_existance                                            |
83 --|                                                                          |
84 --|  USAGE                                                                   |
85 --|       Validate whther item exists on ic_item_mst                         |
86 --|                                                                          |
87 --|  DESCRIPTION                                                             |
88 --|       This function validates that the parameter passed exists           |
89 --|       on ic_item_mst                                                     |
90 --|                                                                          |
91 --|  PARAMETERS                                                              |
92 --|       p_item_no IN Item Number                                           |
93 --|                                                                          |
94 --|  RETURNS                                                                 |
95 --|       Item_id - if the item exists on ic_item_mst                        |
96 --|       0       - if the item does not exist on ic_item_mst                |
97 --|                                                                          |
98 --|  HISTORY                                                                 |
99 --|       11/13/1998 Mike Godfrey - Created                                  |
100 --|                                                                          |
101 --+==========================================================================+
102 -- Func end of comments
103 
104 FUNCTION Validate_item_existance
105 ( p_item_no IN ic_item_mst.item_no%TYPE
106 )
107 RETURN NUMBER
108 IS
109 l_item_id ic_item_mst.item_id%TYPE;
110 CURSOR ic_item_mst_c1 IS
111 SELECT
112   item_id
113 FROM
114   ic_item_mst
115 WHERE
116   item_no = p_item_no;
117 
118 BEGIN
119 
120 OPEN  ic_item_mst_c1;
121 FETCH ic_item_mst_c1 INTO l_item_id;
122 IF (ic_item_mst_c1%NOTFOUND)
123 THEN
124   CLOSE ic_item_mst_c1;
125   RETURN 0;
126 ELSE
127   CLOSE ic_item_mst_c1;
128   RETURN l_item_id;
129 END IF;
130 
131 EXCEPTION
132   WHEN OTHERS THEN
133     RAISE;
134 
135 END Validate_item_existance;
136 
137 -- Func start of comments
138 --+==========================================================================+
139 --|  FUNCTION NAME                                                           |
140 --|       Validate_dualum_ind                                                |
141 --|  USAGE                                                                   |
142 --|       Validates dual UoM indicator to be in the range [0,3]              |
143 --|                                                                          |
144 --|  DESCRIPTION                                                             |
145 --|       This function validates that the parameter passed is in            |
146 --|       the range [0,3]                                                    |
147 --|                                                                          |
148 --|  PARAMETERS                                                              |
149 --|       p_dualum_ind IN Dual Unit Of Measure Indicator                     |
150 --|                                                                          |
151 --|  RETURNS                                                                 |
152 --|       TRUE  - If the parameter is in the required range                  |
153 --|       FALSE - If the parameter is not in the required range              |
154 --|                                                                          |
155 --|  HISTORY                                                                 |
156 --|       11/13/1998 Mike Godfrey - Created                                  |
157 --|                                                                          |
158 --+==========================================================================+
159 -- Func end of comments
160 
161 
162 FUNCTION Validate_dualum_ind
163 ( p_dualum_ind  IN ic_item_mst.dualum_ind%TYPE
164 )
165 RETURN BOOLEAN
166 IS
167 BEGIN
168 
169   RETURN GMA_VALID_GRP.NumRangeCheck(  0
170                                      , 3
171                                      , p_dualum_ind
172                                     );
173 END Validate_dualum_ind;
174 
175 -- Func start of comments
176 --+==========================================================================+
177 --|  FUNCTION NAME                                                           |
178 --|       Validate_item_um2                                                  |
179 --|                                                                          |
180 --|  USAGE                                                                   |
181 --|       Validates secondary Unit Of Measure                                |
182 --|                                                                          |
183 --|  DESCRIPTION                                                             |
184 --|       This function validates that the secondary Unit Of Measure         |
185 --|       is valid                                                           |
186 --|                                                                          |
187 --|  PARAMETERS                                                              |
188 --|       p_dualum_ind IN Dual UoM Indicator                                 |
189 --|       p_item_um2   IN Secondary UoM                                      |
190 --|                                                                          |
191 --|  RETURNS                                                                 |
192 --|       TRUE  - If the secondary UoM is valid                              |
193 --|       FALSE - If the secondary UoM is not valid                          |
194 --|                                                                          |
195 --|  HISTORY                                                                 |
196 --|       11/13/1998 Mike Godfrey - Created                                  |
197 --|                                                                          |
198 --+==========================================================================+
199 -- Func end of comments
200 FUNCTION Validate_item_um2
201 (  p_dualum_ind IN ic_item_mst.dualum_ind%TYPE
202  , p_item_um2   IN ic_item_mst.item_um2%TYPE
203 )
204 RETURN BOOLEAN
205 IS
206 BEGIN
207 
208   IF (p_item_um2 = ' ' OR p_item_um2 IS NULL)
209   THEN
210     IF (p_dualum_ind = 0)
211     THEN
212       RETURN TRUE;
213     ELSE
214       RETURN FALSE;
215     END IF;
216   ELSE
217     RETURN GMA_VALID_GRP.Validate_um(p_item_um2);
218   END IF;
219 
220 EXCEPTION
221   WHEN OTHERS THEN
222     RAISE;
223 
224 END Validate_item_um2;
225 
226 -- Func start of comments
227 --+==========================================================================+
228 --|  FUNCTION NAME                                                           |
229 --|       Validate_deviation                                                 |
230 --|                                                                          |
231 --|  USAGE                                                                   |
232 --|       Validates deviation factor (_lo or _hi)                            |
233 --|                                                                          |
234 --|  DESCRIPTION                                                             |
235 --|       This function validates the deviation factor. If dualum_ind = 0    |
236 --|       then must be 0 else must be a positive value                       |
237 --|                                                                          |
238 --|  PARAMETERS                                                              |
239 --|       p_dualum_ind    IN Dual UoM Indicator                              |
240 --|       p_deviation_ind IN Deviation Factor Indicator                      |
241 --|                                                                          |
242 --|  RETURNS                                                                 |
243 --|       TRUE  - If the deviation factor is valid                           |
244 --|       FALSE - If the deviation factor is not valid                       |
245 --|                                                                          |
246 --|  HISTORY                                                                 |
247 --|       11/13/1998 Mike Godfrey - Created                                  |
248 --|                                                                          |
249 --+==========================================================================+
250 -- Func end of comments
251 FUNCTION Validate_deviation
252 (  p_dualum_ind IN ic_item_mst.dualum_ind%TYPE
253  , p_deviation  IN ic_item_mst.deviation_hi%TYPE
254 )
255 RETURN BOOLEAN
256 IS
257 BEGIN
258 
259   IF (p_dualum_ind = 0 AND p_deviation <> 0)
260   THEN
261     RETURN FALSE;
262   ELSIF (p_deviation < 0)
263   THEN
264     RETURN FALSE;
265   ELSE
266     RETURN TRUE;
267   END IF;
268 
269 END Validate_deviation;
270 
271 -- Func start of comments
272 --+==========================================================================+
273 --|  FUNCTION NAME                                                           |
274 --|       Validate_lot_ctl                                                   |
275 --|                                                                          |
276 --|  USAGE                                                                   |
277 --|       Validates lot_ctl flag to be either 0 or 1                         |
278 --|                                                                          |
279 --|  DESCRIPTION                                                             |
280 --|       This function validates that the parameter passed is               |
281 --|       either 0 or 1                                                      |
282 --|                                                                          |
283 --|  PARAMETERS                                                              |
284 --|       p_lot_ctl IN Lot Control Indicator                                 |
285 --|                                                                          |
286 --|  RETURNS                                                                 |
287 --|       TRUE  - If the control indicator is either 0 or 1                  |
288 --|       FALSE - If the control indicator is not equal to 0 or 1            |
289 --|                                                                          |
290 --|  HISTORY                                                                 |
291 --|       11/13/1998 Mike Godfrey - Created                                  |
292 --|                                                                          |
296 ( p_lot_ctl IN ic_item_mst.lot_ctl%TYPE
293 --+==========================================================================+
294 -- Func end of comments
295 FUNCTION Validate_lot_ctl
297 )
298 RETURN BOOLEAN
299 IS
300 BEGIN
301 
302   RETURN GMA_VALID_GRP.NumRangeCheck(  0
303                                      , 1
304                                      , p_lot_ctl
305                                     );
306 
307 END Validate_lot_ctl;
308 
309 -- Func start of comments
310 --+==========================================================================+
311 --|  FUNCTION NAME                                                           |
312 --|       Validate_lot_indivisible                                           |
313 --|                                                                          |
314 --|  USAGE                                                                   |
315 --|       Validates lot indivisible flag                                     |
316 --|                                                                          |
317 --|  DESCRIPTION                                                             |
318 --|       This function validates the lot indivisible flag.                  |
319 --|       If lot_ctl = 0 then must be 0 else be either 0 or 1                |
320 --|                                                                          |
321 --|  PARAMETERS                                                              |
322 --|       p_lot_ctl         IN NUMBER - Lot Control Indicator                |
323 --|       p_lot_indivisible IN NUMBER - Lot Indivisible Indicator            |
324 --|                                                                          |
325 --|  RETURNS                                                                 |
326 --|       TRUE  - If lot indivisible contains a valid value                  |
327 --|       FALSE - If lot indivisible contains an invalid value               |
328 --|                                                                          |
329 --|  HISTORY                                                                 |
330 --|       11/13/1998 Mike Godfrey - Created                                  |
331 --|                                                                          |
332 --+==========================================================================+
333 -- Func end of comments
334 FUNCTION Validate_lot_indivisible
335 (  p_lot_ctl         IN ic_item_mst.lot_ctl%TYPE
336  , p_lot_indivisible IN ic_item_mst.lot_indivisible%TYPE
337 )
338 RETURN BOOLEAN
339 IS
340 BEGIN
341 
342   IF (p_lot_ctl = 0 AND p_lot_indivisible <> 0)
343   THEN
344     RETURN FALSE;
345   ELSE
346     RETURN GMA_VALID_GRP.NumRangeCheck(  0
347                                        , 1
348                                        , p_lot_indivisible
349                                       );
350   END IF;
351 
352 END Validate_lot_indivisible;
353 
354 -- Func start of comments
355 --+==========================================================================+
356 --|  FUNCTION NAME                                                           |
357 --|       Validate_sublot_ctl                                                |
358 --|                                                                          |
359 --|  USAGE                                                                   |
360 --|       Validates sublot_ctl flag                                          |
361 --|                                                                          |
362 --|  DESCRIPTION                                                             |
363 --|       This function validates the sublot_ctl flag.                       |
364 --|       If lot_ctl = 0 then must be either 0 or 1                          |
365 --|                                                                          |
366 --|  PARAMETERS                                                              |
367 --|       p_lot_ctl    IN NUMBER - Lot Control Indicator                     |
368 --|       p_sublot_ctl IN NUMBER - Sub-Lot Control Indicator                 |
369 --|                                                                          |
370 --|  RETURNS                                                                 |
371 --|       TRUE  - If Sub-lot contains a valid value                          |
372 --|       FALSE - If Sub-lot contains an invalid value                       |
373 --|                                                                          |
374 --|  HISTORY                                                                 |
375 --|       11/13/1998 Mike Godfrey - Created                                  |
376 --|                                                                          |
377 --+==========================================================================+
378 -- Func end of comments
379 FUNCTION Validate_sublot_ctl
380 (  p_lot_ctl    IN ic_item_mst.lot_ctl%TYPE
381  , p_sublot_ctl IN ic_item_mst.sublot_ctl%TYPE
382 )
383 RETURN BOOLEAN
384 IS
385 BEGIN
386 
387   IF (p_lot_ctl = 0 AND p_sublot_ctl <> 0)
388   THEN
389     RETURN FALSE;
390   ELSE
391     RETURN GMA_VALID_GRP.NumRangeCheck(  0
392                                        , 1
393                                        , p_sublot_ctl
394                                       );
395   END IF;
396 
397 END Validate_sublot_ctl;
398 
399 -- Func start of comments
400 --+==========================================================================+
401 --|  FUNCTION NAME                                                           |
402 --|       Validate_loct_ctl                                                  |
403 --|                                                                          |
404 --|  USAGE                                                                   |
405 --|       Validates loct_ctl flag                                            |
409 --|                                                                          |
406 --|                                                                          |
407 --|  DESCRIPTION                                                             |
408 --|       This function validates the loct_ctl flag must be 0, 1 or 2        |
410 --|  PARAMETERS                                                              |
411 --|       p_loct_ctl IN NUMBER - Location Control Indicator                  |
412 --|                                                                          |
413 --|  RETURNS                                                                 |
414 --|       TRUE  - If Location Control contains a valid value                 |
415 --|       FALSE - If Location Control conatins an invalid value              |
416 --|                                                                          |
417 --|  HISTORY                                                                 |
418 --|       11/13/1998 Mike Godfrey - Created                                  |
419 --|                                                                          |
420 --+==========================================================================+
421 -- Func end of comments
422 FUNCTION Validate_loct_ctl
423 (p_loct_ctl IN ic_item_mst.loct_ctl%TYPE
424 )
425 RETURN BOOLEAN
426 IS
427 BEGIN
428 
429   RETURN GMA_VALID_GRP.NumRangeCheck(  0
430                                      , 2
431                                      , p_loct_ctl
432                                     );
433 
434 END Validate_loct_ctl;
435 
436 -- Func start of comments
437 --+==========================================================================+
438 --|  FUNCTION NAME                                                           |
439 --|       Validate_noninv_ind                                                |
440 --|                                                                          |
441 --|  USAGE                                                                   |
442 --|       Validates non inventory indicator                                  |
443 --|                                                                          |
444 --|  DESCRIPTION                                                             |
445 --|       This function validates that the noninv_ind flag must be           |
446 --|       0 or 1 and 0 if lot_ctl = 0                                        |
447 --|                                                                          |
448 --|  PARAMETERS                                                              |
449 --|       p_noninv_ind IN NUMBER - Non Inventory Indicator                   |
450 --|       p_lot_ctl    IN NUMBER - Lot Control Indicator                     |
451 --|                                                                          |
452 --|  RETURNS                                                                 |
453 --|       TRUE  - If Non Inventory Indicator contains a valid value          |
454 --|       FALSE - If Non Inventory Indicator contains an invalid value       |
455 --|                                                                          |
456 --|  HISTORY                                                                 |
457 --|       11/13/1998 Mike Godfrey - Created                                  |
458 --|                                                                          |
459 --+==========================================================================+
460 -- Func end of comments
461 FUNCTION Validate_noninv_ind
462 (  p_noninv_ind IN ic_item_mst.noninv_ind%TYPE
463  , p_lot_ctl    IN ic_item_mst.lot_ctl%TYPE
464 )
465 RETURN BOOLEAN
466 IS
467 BEGIN
468 
469   IF (p_lot_ctl = 1 and p_noninv_ind <> 0)
470   THEN
471     RETURN FALSE;
472   ELSE
473     RETURN GMA_VALID_GRP.NumRangeCheck(  0
474                                        , 1
475                                        , p_noninv_ind
476                                       );
477   END IF;
478 
479 END Validate_noninv_ind;
480 
481 -- Func start of comments
482 --+==========================================================================+
483 --|  FUNCTION NAME                                                           |
484 --|       Validate_match_type                                                |
485 --|                                                                          |
486 --|  USAGE                                                                   |
487 --|       Validates match_type flag                                          |
488 --|                                                                          |
489 --|  DESCRIPTION                                                             |
490 --|       This function validates that the match_type flag is 1,2 or 3       |
491 --|                                                                          |
492 --|  PARAMETERS                                                              |
493 --|       p_match_type IN NUMBER - Match Type Indicator                      |
494 --|                                                                          |
495 --|  RETURNS                                                                 |
496 --|       TRUE  - If Match Type indicator contains a valid value             |
497 --|       FALSE - If Match Type indicator contains an invalid value          |
498 --|                                                                          |
499 --|  HISTORY                                                                 |
500 --|       11/13/1998 Mike Godfrey - Created                                  |
501 --|                                                                          |
502 --+==========================================================================+
503 -- Func end of comments
504 FUNCTION Validate_match_type
505 ( p_match_type IN ic_item_mst.match_type%TYPE
506 )
507 RETURN BOOLEAN
508 IS
509 BEGIN
510 
511   RETURN GMA_VALID_GRP.NumRangeCheck(  1
515 
512                                      , 3
513                                      , p_match_type
514                                     );
516 END Validate_match_type;
517 
518 -- Func start of comments
519 --+==========================================================================+
520 --|  FUNCTION NAME                                                           |
521 --|       Validate_incative_ind                                              |
522 --|                                                                          |
523 --|  USAGE                                                                   |
524 --|       Validates inactive_ind flag                                        |
525 --|                                                                          |
526 --|  DESCRIPTION                                                             |
527 --|       This function validates that the inactive_ind flag is 0 or 1       |
528 --|                                                                          |
529 --|  PARAMETERS                                                              |
530 --|       p_inactive_ind IN NUMBER - Inactive Indicator                      |
531 --|                                                                          |
532 --|  RETURNS                                                                 |
533 --|       TRUE  - If Inactive Indicator contains a valid value               |
534 --|       FALSE - If Inactive Indicator contains an invalid value            |
535 --|                                                                          |
536 --|  HISTORY                                                                 |
537 --|       11/13/1998 Mike Godfrey - Created                                  |
538 --|                                                                          |
539 --+==========================================================================+
540 -- Func end of comments
541 FUNCTION Validate_inactive_ind
542 ( p_inactive_ind IN ic_item_mst.inactive_ind%TYPE
543 )
544 RETURN BOOLEAN
545 IS
546 BEGIN
547 
548   RETURN GMA_VALID_GRP.NumRangeCheck(  0
549                                      , 1
550                                      , p_inactive_ind
551                                     );
552 
553 END Validate_inactive_ind;
554 
555 -- Func start of comments
556 --+==========================================================================+
557 --|  FUNCTION NAME                                                           |
558 --|       Validate_inv_type                                                  |
559 --|                                                                          |
560 --|  USAGE                                                                   |
561 --|       Validates inv_type which must exist on ic_invn_typ if non blank    |
562 --|                                                                          |
563 --|  DESCRIPTION                                                             |
564 --|       This function validates that the inventory type exists on          |
565 --|       ic_invn_typ                                                        |
566 --|                                                                          |
567 --|  PARAMETERS                                                              |
568 --|       p_inv_type IN NUMBER - Inventory Type                              |
569 --|                                                                          |
570 --|  RETURNS                                                                 |
571 --|       TRUE  - If Inventory Type is valid                                 |
572 --|       FALSE - If Inventory Type is invalid                               |
573 --|                                                                          |
574 --|  HISTORY                                                                 |
575 --|       11/13/1998 Mike Godfrey - Created                                  |
576 --|                                                                          |
577 --+==========================================================================+
578 -- Func end of comments
579 FUNCTION Validate_inv_type
580 ( p_inv_type IN ic_item_mst.inv_type%TYPE
581 )
582 RETURN BOOLEAN
583 IS
584 l_inv_type ic_item_mst.inv_type%TYPE;
585 CURSOR ic_invn_typ_c1 IS
586 SELECT
587   inv_type
588 FROM
589   ic_invn_typ
590 WHERE
591     ic_invn_typ.inv_type    = p_inv_type
592 AND ic_invn_typ.delete_mark = 0;
593 
594 BEGIN
595 
596   OPEN ic_invn_typ_c1;
597   FETCH ic_invn_typ_c1 INTO l_inv_type;
598   IF (ic_invn_typ_c1%NOTFOUND)
599   THEN
600     CLOSE ic_invn_typ_c1;
601     RETURN FALSE;
602   ELSE
603     CLOSE ic_invn_typ_c1;
604     RETURN TRUE;
605   END IF;
606 
607 EXCEPTION
608   WHEN OTHERS THEN
609     RAISE;
610 
611 END Validate_inv_type;
612 
613 -- Func start of comments
614 --+==========================================================================+
615 --|  FUNCTION NAME                                                           |
616 --|       Validate_shelf_life                                                |
617 --|                                                                          |
618 --|  USAGE                                                                   |
619 --|       Validates shelf_life flag                                          |
620 --|                                                                          |
621 --|  DESCRIPTION                                                             |
622 --|       This function validates that the shelf life flag is not negative   |
623 --|       and equal to 0 if grade_ctl = 0                                    |
624 --|                                                                          |
625 --|  PARAMETERS                                                              |
629 --|  RETURNS                                                                 |
626 --|       p_shelf_life IN NUMBER - Shelf Life                                |
627 --|       p_grade_ctl  IN NUMBER - Grade Control Indicator                   |
628 --|                                                                          |
630 --|       TRUE  - If Shelf Life contains a valid value                       |
631 --|       FALSE - If Shelf Life contains an invalid value                    |
632 --|                                                                          |
633 --|  HISTORY                                                                 |
634 --|       11/13/1998 Mike Godfrey - Created                                  |
635 --|                                                                          |
636 --+==========================================================================+
637 -- Func end of comments
638 FUNCTION Validate_shelf_life
639 (  p_shelf_life IN ic_item_mst.shelf_life%TYPE
640  , p_grade_ctl  IN ic_item_mst.grade_ctl%TYPE
641 )
642 RETURN BOOLEAN
643 IS
644 BEGIN
645 
646   IF (p_grade_ctl = 0 and p_shelf_life <> 0)
647   THEN
648     RETURN FALSE;
649   ELSIF (p_shelf_life < 0 OR p_shelf_life > 9999)
650   THEN
651     RETURN FALSE;
652   ELSE
653     RETURN TRUE;
654   END IF;
655 
656 END Validate_shelf_life;
657 
658 -- Func start of comments
659 --+==========================================================================+
660 --|  FUNCTION NAME                                                           |
661 --|       Validate_retest_interval                                           |
662 --|                                                                          |
663 --|  USAGE                                                                   |
664 --|       Validates retest_interval flag                                     |
665 --|                                                                          |
666 --|  DESCRIPTION                                                             |
667 --|       This function validates that the retest interval flag is not       |
668 --|       negative and equal to 0 if grade_ctl = 0                           |
669 --|                                                                          |
670 --|  PARAMETERS                                                              |
671 --|       p_retest_interval IN NUMBER - Retest Interval Indicator            |
672 --|       p_grade_ctl       IN NUMBER - Grade Control Indicator              |
673 --|                                                                          |
674 --|  RETURNS                                                                 |
675 --|       TRUE  - If Retest Interval contains a valid value                  |
676 --|       FALSE - If Retest Interval contains an invalid value               |
677 --|                                                                          |
678 --|  HISTORY                                                                 |
679 --|       11/13/1998 Mike Godfrey - Created                                  |
680 --|                                                                          |
681 --+==========================================================================+
682 -- Func end of comments
683 FUNCTION Validate_retest_interval
684 (  p_retest_interval IN ic_item_mst.retest_interval%TYPE
685  , p_grade_ctl       IN ic_item_mst.grade_ctl%TYPE
686 )
687 RETURN BOOLEAN
688 IS
689 BEGIN
690 
691   IF (p_grade_ctl = 0 and p_retest_interval <> 0)
692   THEN
693     RETURN FALSE;
694   ELSIF (p_retest_interval < 0 OR p_retest_interval > 9999)
695   THEN
696     RETURN FALSE;
697   ELSE
698     RETURN TRUE;
699   END IF;
700 
701 END Validate_retest_interval;
702 
703 -- Func start of comments
704 --+==========================================================================+
705 --|  FUNCTION NAME                                                           |
706 --|       Validate_item_abc_code                                             |
707 --|                                                                          |
708 --|  USAGE                                                                   |
709 --|       Validates item_abccode                                             |
710 --|                                                                          |
711 --|  DESCRIPTION                                                             |
712 --|       This function validates that the item ABC code exists              |
713 --|       on ic_rank_mst                                                     |
714 --|                                                                          |
715 --|  PARAMETERS                                                              |
716 --|       p_item_abccode IN VARCHAR2(4) - Item ABC Code                      |
717 --|                                                                          |
718 --|  RETURNS                                                                 |
719 --|       TRUE  - If Item ABC Code contains a valid value                    |
720 --|       FALSE - If Item ABC Code contains an invalid value                 |
721 --|                                                                          |
722 --|  HISTORY                                                                 |
723 --|       11/13/1998 Mike Godfrey - Created                                  |
724 --|                                                                          |
725 --+==========================================================================+
726 -- Func end of comments
727 FUNCTION Validate_item_abccode
728 ( p_item_abccode IN ic_item_mst.item_abccode%TYPE
729 )
730 RETURN BOOLEAN
731 IS
732 l_item_abccode ic_item_mst.item_abccode%TYPE;
733 CURSOR ic_rank_mst_c1 IS
734 SELECT
735   abc_code
736 FROM
737   ic_rank_mst
738 WHERE
739     ic_rank_mst.abc_code    = p_item_abccode
743 
740 AND ic_rank_mst.delete_mark = 0;
741 
742 BEGIN
744   IF (p_item_abccode = ' ' OR p_item_abccode IS NULL)
745   THEN
746     RETURN TRUE;
747   ELSE
748     OPEN ic_rank_mst_c1;
749     FETCH ic_rank_mst_c1 INTO l_item_abccode;
750     IF (ic_rank_mst_c1%NOTFOUND)
751     THEN
752       CLOSE ic_rank_mst_c1;
753       RETURN FALSE;
754     ELSE
755       CLOSE ic_rank_mst_c1;
756       RETURN TRUE;
757     END IF;
758   END IF;
759 
760 EXCEPTION
761   WHEN OTHERS THEN
762     RAISE;
763 
764 END Validate_item_abccode;
765 
766 -- Func start of comments
767 --+==========================================================================+
768 --|  FUNCTION NAME                                                           |
769 --|       Validate_gl_class                                                  |
770 --|                                                                          |
771 --|  USAGE                                                                   |
772 --|       Validates gl_class                                                 |
773 --|                                                                          |
774 --|  DESCRIPTION                                                             |
775 --|       This function validates that the GL Class code exists              |
776 --|       on ic_gled_cls                                                     |
777 --|                                                                          |
778 --|  PARAMETERS                                                              |
779 --|       p_gl_class IN VARCHAR2(8) - GL Class                               |
780 --|                                                                          |
781 --|  RETURNS                                                                 |
782 --|       TRUE  - If GL Class Code contains a valid value                    |
783 --|       FALSE - If GL Class Code contains an invalid value                 |
784 --|                                                                          |
785 --|  HISTORY                                                                 |
786 --|       11/13/1998 Mike Godfrey - Created                                  |
787 --|                                                                          |
788 --+==========================================================================+
789 -- Func end of comments
790 FUNCTION Validate_gl_class
791 ( p_gl_class IN ic_item_mst.gl_class%TYPE
792 )
793 RETURN BOOLEAN
794 IS
795 l_gl_class ic_item_mst.gl_class%TYPE;
796 CURSOR ic_gled_cls_c1 IS
797 SELECT
798   icgl_class
799 FROM
800   ic_gled_cls
801 WHERE
802     ic_gled_cls.icgl_class  = p_gl_class
803 AND ic_gled_cls.delete_mark = 0;
804 
805 BEGIN
806 
807   OPEN ic_gled_cls_c1;
808   FETCH ic_gled_cls_c1 INTO l_gl_class;
809   IF (ic_gled_cls_c1%NOTFOUND)
810   THEN
811     CLOSE ic_gled_cls_c1;
812     RETURN FALSE;
813   ELSE
814     CLOSE ic_gled_cls_c1;
815     RETURN TRUE;
816   END IF;
817 
818 EXCEPTION
819   WHEN OTHERS THEN
820     RAISE;
821 
822 END Validate_gl_class;
823 
824 -- Func start of comments
825 --+==========================================================================+
826 --|  FUNCTION NAME                                                           |
827 --|       Validate_inv_class                                                 |
828 --|                                                                          |
829 --|  USAGE                                                                   |
830 --|       Validates inv_class                                                |
831 --|                                                                          |
832 --|  DESCRIPTION                                                             |
833 --|       This function validates that the Inventory Class exists            |
834 --|       on ic_invn_cls                                                     |
835 --|                                                                          |
836 --|  PARAMETERS                                                              |
837 --|       p_inv_class IN VARCHAR2(8) - Inventory Class                       |
838 --|                                                                          |
839 --|  RETURNS                                                                 |
840 --|       TRUE  - If Inventory Class contains a valid value                  |
841 --|       FALSE - If Inventory Class contains an invalid value               |
842 --|                                                                          |
843 --|  HISTORY                                                                 |
844 --|       11/13/1998 Mike Godfrey - Created                                  |
845 --|                                                                          |
846 --+==========================================================================+
847 -- Func end of comments
848 FUNCTION Validate_inv_class
849 ( p_inv_class IN ic_item_mst.inv_class%TYPE
850 )
851 RETURN BOOLEAN
852 IS
853 l_inv_class ic_item_mst.inv_class%TYPE;
854 CURSOR ic_invn_cls_c1 IS
855 SELECT
856   icinv_class
857 FROM
858   ic_invn_cls
859 WHERE
860     ic_invn_cls.icinv_class = p_inv_class
861 AND ic_invn_cls.delete_mark = 0;
862 
863 BEGIN
864 
865   OPEN ic_invn_cls_c1;
866   FETCH ic_invn_cls_c1 INTO l_inv_class;
867   IF (ic_invn_cls_c1%NOTFOUND)
868   THEN
869     CLOSE ic_invn_cls_c1;
870     RETURN FALSE;
871   ELSE
872     CLOSE ic_invn_cls_c1;
873     RETURN TRUE;
874   END IF;
875 
876 EXCEPTION
877   WHEN OTHERS THEN
878     RAISE;
879 
880 END Validate_inv_class;
881 
882 -- Func start of comments
886 --|                                                                          |
883 --+==========================================================================+
884 --|  FUNCTION NAME                                                           |
885 --|       Validate_sales_class                                               |
887 --|  USAGE                                                                   |
888 --|       Validates sales_class                                              |
889 --|                                                                          |
890 --|  DESCRIPTION                                                             |
891 --|       This function validates that the Sales Class exists                |
892 --|       on ic_sale_cls                                                     |
893 --|                                                                          |
894 --|  PARAMETERS                                                              |
895 --|       p_sales_class IN VARCHAR2(8) - Sales Class                         |
896 --|                                                                          |
897 --|  RETURNS                                                                 |
898 --|       TRUE  - If Sales Class contains a valid value                      |
899 --|       FALSE - If Sales Class contains an invalid value                   |
900 --|                                                                          |
901 --|  HISTORY                                                                 |
902 --|       11/13/1998 Mike Godfrey - Created                                  |
903 --|                                                                          |
904 --+==========================================================================+
905 -- Func end of comments
906 FUNCTION Validate_sales_class
907 ( p_sales_class IN ic_item_mst.sales_class%TYPE
908 )
909 RETURN BOOLEAN
910 IS
911 l_sales_class ic_item_mst.sales_class%TYPE;
912 CURSOR ic_sale_cls_c1 IS
913 SELECT
914   icsales_class
915 FROM
916   ic_sale_cls
917 WHERE
918     ic_sale_cls.icsales_class = p_sales_class
919 AND ic_sale_cls.delete_mark   = 0;
920 
921 BEGIN
922 
923   OPEN ic_sale_cls_c1;
924   FETCH ic_sale_cls_c1 INTO l_sales_class;
925   IF (ic_sale_cls_c1%NOTFOUND)
926   THEN
927     CLOSE ic_sale_cls_c1;
928     RETURN FALSE;
929   ELSE
930     CLOSE ic_sale_cls_c1;
931     RETURN TRUE;
932   END IF;
933 
934 EXCEPTION
935   WHEN OTHERS THEN
936     RAISE;
937 
938 END Validate_sales_class;
939 
940 -- Func start of comments
941 --+==========================================================================+
942 --|  FUNCTION NAME                                                           |
943 --|       Validate_ship_class                                                |
944 --|                                                                          |
945 --|  USAGE                                                                   |
946 --|       Validates ship_class                                               |
947 --|                                                                          |
948 --|  DESCRIPTION                                                             |
949 --|       This function validates that the Ship Class exists                 |
950 --|       on ic_ship_cls                                                     |
951 --|                                                                          |
952 --|  PARAMETERS                                                              |
953 --|       p_ship_class IN VARCHAR2(8) - Ship Class                           |
954 --|                                                                          |
955 --|  RETURNS                                                                 |
956 --|       TRUE  - If Ship Class contains a valid value                       |
957 --|       FALSE - If Ship Class contains an invalid value                    |
958 --|                                                                          |
959 --|  HISTORY                                                                 |
960 --|       11/13/1998 Mike Godfrey - Created                                  |
961 --|                                                                          |
962 --+==========================================================================+
963 -- Func end of comments
964 FUNCTION Validate_ship_class
965 ( p_ship_class IN ic_item_mst.ship_class%TYPE
966 )
967 RETURN BOOLEAN
968 IS
969 l_ship_class ic_item_mst.ship_class%TYPE;
970 CURSOR ic_ship_cls_c1 IS
971 SELECT
972   icship_class
973 FROM
974   ic_ship_cls
975 WHERE
976     ic_ship_cls.icship_class = p_ship_class
977 AND ic_ship_cls.delete_mark  = 0;
978 
979 BEGIN
980 
981   OPEN ic_ship_cls_c1;
982   FETCH ic_ship_cls_c1 INTO l_ship_class;
983   IF (ic_ship_cls_c1%NOTFOUND)
984   THEN
985     CLOSE ic_ship_cls_c1;
986     RETURN FALSE;
987   ELSE
988     CLOSE ic_ship_cls_c1;
989     RETURN TRUE;
990   END IF;
991 
992 EXCEPTION
993   WHEN OTHERS THEN
994     RAISE;
995 
996 END Validate_ship_class;
997 
998 -- Func start of comments
999 --+==========================================================================+
1000 --|  FUNCTION NAME                                                           |
1001 --|       Validate_frt_class                                                 |
1002 --|                                                                          |
1003 --|  USAGE                                                                   |
1004 --|       Validates frt_class                                                |
1005 --|                                                                          |
1006 --|  DESCRIPTION                                                             |
1010 --|  PARAMETERS                                                              |
1007 --|       This function validates that the Freight Class exists              |
1008 --|       on ic_frgt_cls                                                     |
1009 --|                                                                          |
1011 --|       p_frgt_class IN VARCHAR2(8) - Freight Class                        |
1012 --|                                                                          |
1013 --|  RETURNS                                                                 |
1014 --|       TRUE  - If Freight Class contains a valid value                    |
1015 --|       FALSE - If Freight Class contains an invalid value                 |
1016 --|                                                                          |
1017 --|  HISTORY                                                                 |
1018 --|       11/13/1998 Mike Godfrey - Created                                  |
1019 --|                                                                          |
1020 --+==========================================================================+
1021 -- Func end of comments
1022 FUNCTION Validate_frt_class
1023 ( p_frt_class IN ic_item_mst.frt_class%TYPE
1024 )
1025 RETURN BOOLEAN
1026 IS
1027 l_frt_class ic_item_mst.frt_class%TYPE;
1028 CURSOR ic_frgt_cls_c1 IS
1029 SELECT
1030   icfrt_class
1031 FROM
1032   ic_frgt_cls
1033 WHERE
1034     ic_frgt_cls.icfrt_class = p_frt_class
1035 AND ic_frgt_cls.delete_mark = 0;
1036 
1037 BEGIN
1038 
1039   OPEN ic_frgt_cls_c1;
1040   FETCH ic_frgt_cls_c1 INTO l_frt_class;
1041   IF (ic_frgt_cls_c1%NOTFOUND)
1042   THEN
1043     CLOSE ic_frgt_cls_c1;
1044     RETURN FALSE;
1045   ELSE
1046     CLOSE ic_frgt_cls_c1;
1047     RETURN TRUE;
1048   END IF;
1049 
1050 EXCEPTION
1051   WHEN OTHERS THEN
1052     RAISE;
1053 
1054 END Validate_frt_class;
1055 
1056 -- Func start of comments
1057 --+==========================================================================+
1058 --|  FUNCTION NAME                                                           |
1059 --|       Validate_price_class                                               |
1060 --|                                                                          |
1061 --|  USAGE                                                                   |
1062 --|       Validates price_class                                              |
1063 --|                                                                          |
1064 --|  DESCRIPTION                                                             |
1065 --|       This function validates that the Price Class exists                |
1066 --|       on ic_prce_cls                                                     |
1067 --|                                                                          |
1068 --|  PARAMETERS                                                              |
1069 --|       p_price_class IN VARCHAR2(8) - Price Class                         |
1070 --|                                                                          |
1071 --|  RETURNS                                                                 |
1072 --|       TRUE  - If Price Class contains a valid value                      |
1073 --|       FALSE - If Price Class contains an invalid value                   |
1074 --|                                                                          |
1075 --|  HISTORY                                                                 |
1076 --|       11/13/1998 Mike Godfrey - Created                                  |
1077 --|                                                                          |
1078 --+==========================================================================+
1079 -- Func end of comments
1080 FUNCTION Validate_price_class
1081 ( p_price_class IN ic_item_mst.price_class%TYPE
1082 )
1083 RETURN BOOLEAN
1084 IS
1085 l_price_class ic_item_mst.price_class%TYPE;
1086 CURSOR ic_prce_cls_c1 IS
1087 SELECT
1088   icprice_class
1089 FROM
1090   ic_prce_cls
1091 WHERE
1092     ic_prce_cls.icprice_class = p_price_class
1093 AND ic_prce_cls.delete_mark   = 0;
1094 
1095 BEGIN
1096 
1097   OPEN ic_prce_cls_c1;
1098   FETCH ic_prce_cls_c1 INTO l_price_class;
1099   IF (ic_prce_cls_c1%NOTFOUND)
1100   THEN
1101     CLOSE ic_prce_cls_c1;
1102     RETURN FALSE;
1103   ELSE
1104     CLOSE ic_prce_cls_c1;
1105     RETURN TRUE;
1106   END IF;
1107 
1108 EXCEPTION
1109   WHEN OTHERS THEN
1110     RAISE;
1111 
1112 END Validate_price_class;
1113 
1114 -- Func start of comments
1115 --+==========================================================================+
1116 --|  FUNCTION NAME                                                           |
1117 --|       Validate_storage_class                                             |
1118 --|                                                                          |
1119 --|  USAGE                                                                   |
1120 --|       Validates storage_class                                            |
1121 --|                                                                          |
1122 --|  DESCRIPTION                                                             |
1123 --|       This function validates that the Storage Class exists              |
1124 --|       on ic_stor_cls                                                     |
1125 --|                                                                          |
1126 --|  PARAMETERS                                                              |
1127 --|       p_storage_class IN VARCHAR2(8) - Storage Class                     |
1128 --|                                                                          |
1129 --|  RETURNS                                                                 |
1130 --|       TRUE  - If Storage Class contains a valid value                    |
1134 --|       11/13/1998 Mike Godfrey - Created                                  |
1131 --|       FALSE - If Storage Class contains an invalid value                 |
1132 --|                                                                          |
1133 --|  HISTORY                                                                 |
1135 --|                                                                          |
1136 --+==========================================================================+
1137 -- Func end of comments
1138 FUNCTION Validate_storage_class
1139 ( p_storage_class IN ic_item_mst.storage_class%TYPE
1140 )
1141 RETURN BOOLEAN
1142 IS
1143 l_storage_class ic_item_mst.storage_class%TYPE;
1144 CURSOR ic_stor_cls_c1 IS
1145 SELECT
1146   icstorage_class
1147 FROM
1148   ic_stor_cls
1149 WHERE
1150     ic_stor_cls.icstorage_class = p_storage_class
1151 AND ic_stor_cls.delete_mark     = 0;
1152 
1153 BEGIN
1154 
1155   OPEN ic_stor_cls_c1;
1156   FETCH ic_stor_cls_c1 INTO l_storage_class;
1157   IF (ic_stor_cls_c1%NOTFOUND)
1158   THEN
1159     CLOSE ic_stor_cls_c1;
1160     RETURN FALSE;
1161   ELSE
1162     CLOSE ic_stor_cls_c1;
1163     RETURN TRUE;
1164   END IF;
1165 
1166 EXCEPTION
1167   WHEN OTHERS THEN
1168     RAISE;
1169 
1170 END Validate_storage_class;
1171 
1172 -- Func start of comments
1173 --+==========================================================================+
1174 --|  FUNCTION NAME                                                           |
1175 --|       Validate_purch_class                                               |
1176 --|                                                                          |
1177 --|  USAGE                                                                   |
1178 --|       Validates purch_class                                              |
1179 --|                                                                          |
1180 --|  DESCRIPTION                                                             |
1181 --|       This function validates that the Purchase Class exists             |
1182 --|       on ic_prch_cls                                                     |
1183 --|                                                                          |
1184 --|  PARAMETERS                                                              |
1185 --|       p_purch_class IN VARCHAR2(8) - Purchase Class                      |
1186 --|                                                                          |
1187 --|  RETURNS                                                                 |
1188 --|       TRUE  - If Purchase Class contains a valid value                   |
1189 --|       FALSE - If Purchase Class contains an invalid value                |
1190 --|                                                                          |
1191 --|  HISTORY                                                                 |
1192 --|       11/13/1998 Mike Godfrey - Created                                  |
1193 --|                                                                          |
1194 --+==========================================================================+
1195 -- Func end of comments
1196 FUNCTION Validate_purch_class
1197 ( p_purch_class IN ic_item_mst.purch_class%TYPE
1198 )
1199 RETURN BOOLEAN
1200 IS
1201 l_purch_class ic_item_mst.purch_class%TYPE;
1202 CURSOR ic_prch_cls_c1 IS
1203 SELECT
1204   icpurch_class
1205 FROM
1206   ic_prch_cls
1207 WHERE
1208     ic_prch_cls.icpurch_class = p_purch_class
1209 AND ic_prch_cls.delete_mark   = 0;
1210 
1211 BEGIN
1212 
1213   OPEN ic_prch_cls_c1;
1214   FETCH ic_prch_cls_c1 INTO l_purch_class;
1215   IF (ic_prch_cls_c1%NOTFOUND)
1216   THEN
1217     CLOSE ic_prch_cls_c1;
1218     RETURN FALSE;
1219   ELSE
1220     CLOSE ic_prch_cls_c1;
1221     RETURN TRUE;
1222   END IF;
1223 
1224 EXCEPTION
1225   WHEN OTHERS THEN
1226     RAISE;
1227 
1228 END Validate_purch_class;
1229 
1230 -- Func start of comments
1231 --+==========================================================================+
1232 --|  FUNCTION NAME                                                           |
1233 --|       Validate_tax_class                                                 |
1234 --|                                                                          |
1235 --|  USAGE                                                                   |
1236 --|       Validates tax_class                                                |
1237 --|                                                                          |
1238 --|  DESCRIPTION                                                             |
1239 --|       This function validates that the Tax Class exists                  |
1240 --|       on ic_taxn_cls                                                     |
1241 --|                                                                          |
1242 --|  PARAMETERS                                                              |
1243 --|       p_tax_class IN VARCHAR2(8) - Tax Class                             |
1244 --|                                                                          |
1245 --|  RETURNS                                                                 |
1246 --|       TRUE  - If Tax Class contains a valid value                        |
1247 --|       FALSE - If Tax Class contains an invalid value                     |
1248 --|                                                                          |
1249 --|  HISTORY                                                                 |
1250 --|       11/13/1998 Mike Godfrey - Created                                  |
1251 --|                                                                          |
1252 --+==========================================================================+
1253 -- Func end of comments
1254 FUNCTION Validate_tax_class
1255 ( p_tax_class IN ic_item_mst.tax_class%TYPE
1256 )
1257 RETURN BOOLEAN
1258 IS
1262   ictax_class
1259 l_tax_class ic_item_mst.tax_class%TYPE;
1260 CURSOR ic_taxn_cls_c1 IS
1261 SELECT
1263 FROM
1264   ic_taxn_cls
1265 WHERE
1266     ic_taxn_cls.ictax_class = p_tax_class
1267 AND ic_taxn_cls.delete_mark = 0;
1268 
1269 BEGIN
1270 
1271   OPEN ic_taxn_cls_c1;
1272   FETCH ic_taxn_cls_c1 INTO l_tax_class;
1273   IF (ic_taxn_cls_c1%NOTFOUND)
1274   THEN
1275     CLOSE ic_taxn_cls_c1;
1276     RETURN FALSE;
1277   ELSE
1278     CLOSE ic_taxn_cls_c1;
1279     RETURN TRUE;
1280   END IF;
1281 
1282 EXCEPTION
1283   WHEN OTHERS THEN
1284     RAISE;
1285 
1286 END Validate_tax_class;
1287 
1288 -- Func start of comments
1289 --+==========================================================================+
1290 --|  FUNCTION NAME                                                           |
1291 --|       Validate_custom_class                                              |
1292 --|                                                                          |
1293 --|  USAGE                                                                   |
1294 --|       Validates custom_class                                             |
1295 --|                                                                          |
1296 --|  DESCRIPTION                                                             |
1297 --|       This function validates that the Custom Class exists               |
1298 --|       on ic_ctms_cls                                                     |
1299 --|                                                                          |
1300 --|  PARAMETERS                                                              |
1301 --|       p_customs_class IN VARCHAR2(8) - Customs Class                     |
1302 --|                                                                          |
1303 --|  RETURNS                                                                 |
1304 --|       TRUE  - If Customs Class contains a valid value                    |
1305 --|       FALSE - If Customs Class contains an invalid value                 |
1306 --|                                                                          |
1307 --|  HISTORY                                                                 |
1308 --|       11/13/1998 Mike Godfrey - Created                                  |
1309 --|                                                                          |
1310 --+==========================================================================+
1311 -- Func end of comments
1312 FUNCTION Validate_customs_class
1313 ( p_customs_class IN ic_item_mst.customs_class%TYPE
1314 )
1315 RETURN BOOLEAN
1316 IS
1317 l_customs_class ic_item_mst.customs_class%TYPE;
1318 CURSOR ic_ctms_cls_c1 IS
1319 SELECT
1320   iccustoms_class
1321 FROM
1322   ic_ctms_cls
1323 WHERE
1324     ic_ctms_cls.iccustoms_class = p_customs_class
1325 AND ic_ctms_cls.delete_mark     = 0;
1326 
1327 BEGIN
1328 
1329   OPEN ic_ctms_cls_c1;
1330   FETCH ic_ctms_cls_c1 INTO l_customs_class;
1331   IF (ic_ctms_cls_c1%NOTFOUND)
1332   THEN
1333     CLOSE ic_ctms_cls_c1;
1334     RETURN FALSE;
1335   ELSE
1336     CLOSE ic_ctms_cls_c1;
1337     RETURN TRUE;
1338   END IF;
1339 
1340 EXCEPTION
1341   WHEN OTHERS THEN
1342     RAISE;
1343 
1344 END Validate_customs_class;
1345 
1346 -- Func start of comments
1347 --+==========================================================================+
1348 --|  FUNCTION NAME                                                           |
1349 --|       Validate_alloc_class                                               |
1350 --|                                                                          |
1351 --|  USAGE                                                                   |
1352 --|       Validates alloc_class                                              |
1353 --|                                                                          |
1354 --|  DESCRIPTION                                                             |
1355 --|       This function validates that the Allocation Class exists           |
1356 --|       on ic_allc_cls                                                     |
1357 --|                                                                          |
1358 --|  PARAMETERS                                                              |
1359 --|       p_alloc_class IN VARCHAR2(8) - Allocation Clas                     |
1360 --|                                                                          |
1361 --|  RETURNS                                                                 |
1362 --|       TRUE  - If Allocation Class contains a valid value                 |
1363 --|       FALSE - If Allocation Class contains an invalid value              |
1364 --|                                                                          |
1365 --|  HISTORY                                                                 |
1366 --|       11/13/1998 Mike Godfrey - Created                                  |
1367 --|                                                                          |
1368 --+==========================================================================+
1369 -- Func end of comments
1370 FUNCTION Validate_alloc_class
1371 ( p_alloc_class IN ic_item_mst.alloc_class%TYPE
1372 )
1373 RETURN BOOLEAN
1374 IS
1375 l_alloc_class ic_item_mst.alloc_class%TYPE;
1376 CURSOR ic_allc_cls_c1 IS
1377 SELECT
1378   alloc_class
1379 FROM
1380   ic_allc_cls
1381 WHERE
1382     ic_allc_cls.alloc_class = p_alloc_class
1383 AND ic_allc_cls.delete_mark = 0;
1384 
1385 BEGIN
1386 
1387   OPEN ic_allc_cls_c1;
1388   FETCH ic_allc_cls_c1 INTO l_alloc_class;
1389   IF (ic_allc_cls_c1%NOTFOUND)
1390   THEN
1391     CLOSE ic_allc_cls_c1;
1392     RETURN FALSE;
1393   ELSE
1394     CLOSE ic_allc_cls_c1;
1395     RETURN TRUE;
1396   END IF;
1397 
1398 EXCEPTION
1402 END Validate_alloc_class;
1399   WHEN OTHERS THEN
1400     RAISE;
1401 
1403 
1404 -- Func start of comments
1405 --+==========================================================================+
1406 --|  FUNCTION NAME                                                           |
1407 --|       Validate_planning_class                                            |
1408 --|                                                                          |
1409 --|  USAGE                                                                   |
1410 --|       Validates planning_class                                           |
1411 --|                                                                          |
1412 --|  DESCRIPTION                                                             |
1413 --|       This function validates that the Planning Class exists             |
1414 --|       on ic_plng_cls                                                     |
1415 --|                                                                          |
1416 --|  PARAMETERS                                                              |
1417 --|       p_planning_class IN VARCHAR2(8) - Planning Class                   |
1418 --|                                                                          |
1419 --|  RETURNS                                                                 |
1420 --|       TRUE  - If Planning Class contains a valid value                   |
1421 --|       FALSE - If Planning Class contains an invalid value                |
1422 --|                                                                          |
1423 --|  HISTORY                                                                 |
1424 --|       11/13/1998 Mike Godfrey - Created                                  |
1425 --|                                                                          |
1426 --+==========================================================================+
1427 -- Func end of comments
1428 FUNCTION Validate_planning_class
1429 ( p_planning_class IN ic_item_mst.planning_class%TYPE
1430 )
1431 RETURN BOOLEAN
1432 IS
1433 l_planning_class ic_item_mst.planning_class%TYPE;
1434 CURSOR ps_plng_cls_c1 IS
1435 SELECT
1436   planning_class
1437 FROM
1438   ps_plng_cls
1439 WHERE
1440     ps_plng_cls.planning_class = p_planning_class
1441 AND ps_plng_cls.delete_mark    = 0;
1442 
1443 BEGIN
1444 
1445   OPEN ps_plng_cls_c1;
1446   FETCH ps_plng_cls_c1 INTO l_planning_class;
1447   IF (ps_plng_cls_c1%NOTFOUND)
1448   THEN
1449     CLOSE ps_plng_cls_c1;
1450     RETURN FALSE;
1451   ELSE
1452     CLOSE ps_plng_cls_c1;
1453     RETURN TRUE;
1454   END IF;
1455 
1456 EXCEPTION
1457   WHEN OTHERS THEN
1458     RAISE;
1459 
1460 END Validate_planning_class;
1461 
1462 -- Func start of comments
1463 --+==========================================================================+
1464 --|  FUNCTION NAME                                                           |
1465 --|       Validate_itemcost_class                                            |
1466 --|                                                                          |
1467 --|  USAGE                                                                   |
1468 --|       Validates itemcost_class                                           |
1469 --|                                                                          |
1470 --|  DESCRIPTION                                                             |
1471 --|       This function validates that the Item Cost Class exists            |
1472 --|       on ic_cost_cls                                                     |
1473 --|                                                                          |
1474 --|  PARAMETERS                                                              |
1475 --|       p_itemcost_class class IN VARCHAR2(8) - Item Cost Class            |
1476 --|                                                                          |
1477 --|  RETURNS                                                                 |
1478 --|       TRUE  - If Item Cost Class contains a valid value                  |
1479 --|       FALSE - If Item Cost Class contains an invalid value               |
1480 --|                                                                          |
1481 --|  HISTORY                                                                 |
1482 --|       11/13/1998 Mike Godfrey - Created                                  |
1483 --|                                                                          |
1484 --+==========================================================================+
1485 -- Func end of comments
1486 FUNCTION Validate_itemcost_class
1487 ( p_itemcost_class IN ic_item_mst.itemcost_class%TYPE
1488 )
1489 RETURN BOOLEAN
1490 IS
1491 l_itemcost_class ic_item_mst.itemcost_class%TYPE;
1492 CURSOR ic_cost_cls_c1 IS
1493 SELECT
1494   itemcost_class
1495 FROM
1496   ic_cost_cls
1497 WHERE
1498     ic_cost_cls.itemcost_class = p_itemcost_class
1499 AND ic_cost_cls.delete_mark    = 0;
1500 
1501 BEGIN
1502 
1503   OPEN ic_cost_cls_c1;
1504   FETCH ic_cost_cls_c1 INTO l_itemcost_class;
1505   IF (ic_cost_cls_c1%NOTFOUND) THEN
1506     CLOSE ic_cost_cls_c1;
1507     RETURN FALSE;
1508   ELSE
1509     CLOSE ic_cost_cls_c1;
1510     RETURN TRUE;
1511   END IF;
1512 
1513 EXCEPTION
1514   WHEN OTHERS THEN
1515     RAISE;
1516 
1517 END Validate_itemcost_class;
1518 
1519 -- Func start of comments
1520 --+==========================================================================+
1521 --|  FUNCTION NAME                                                           |
1522 --|       Validate_cost_mthd_code                                            |
1523 --|                                                                          |
1524 --|  USAGE                                                                   |
1525 --|       Validates cost_mthd_code                                           |
1529 --|       on cm_mthd_mst                                                     |
1526 --|                                                                          |
1527 --|  DESCRIPTION                                                             |
1528 --|       This function validates that the cost Method Code exists           |
1530 --|                                                                          |
1531 --|  PARAMETERS                                                              |
1532 --|       p_cost_mthd_code IN VARCHAR2(4) - Cost Method Code                 |
1533 --|                                                                          |
1534 --|  RETURNS                                                                 |
1535 --|       TRUE  - If Cost Method contains a valid value                      |
1536 --|       FALSE - If Cost Method contains an invalid value                   |
1537 --|                                                                          |
1538 --|  HISTORY                                                                 |
1539 --|       11/13/1998 Mike Godfrey - Created                                  |
1540 --|                                                                          |
1541 --+==========================================================================+
1542 -- Func end of comments
1543 FUNCTION Validate_cost_mthd_code
1544 ( p_cost_mthd_code IN ic_item_mst.cost_mthd_code%TYPE
1545 )
1546 RETURN BOOLEAN
1547 IS
1548 l_cost_mthd_code ic_item_mst.cost_mthd_code%TYPE;
1549 CURSOR cm_mthd_mst_c1 IS
1550 SELECT
1551   cost_mthd_code
1552 FROM
1553   cm_mthd_mst
1554 WHERE
1555     cm_mthd_mst.cost_mthd_code = p_cost_mthd_code
1556 AND cm_mthd_mst.delete_mark    = 0;
1557 
1558 BEGIN
1559 
1560   OPEN cm_mthd_mst_c1;
1561   FETCH cm_mthd_mst_c1 INTO l_cost_mthd_code;
1562   IF (cm_mthd_mst_c1%NOTFOUND)
1563   THEN
1564     CLOSE cm_mthd_mst_c1;
1565     RETURN FALSE;
1566   ELSE
1567     CLOSE cm_mthd_mst_c1;
1568     RETURN TRUE;
1569   END IF;
1570 
1571 EXCEPTION
1572   WHEN OTHERS THEN
1573     RAISE;
1574 
1575 END Validate_cost_mthd_code;
1576 
1577 -- Func start of comments
1578 --+==========================================================================+
1579 --|  FUNCTION NAME                                                           |
1580 --|       Validate_grade_ctl                                                 |
1581 --|                                                                          |
1582 --|  USAGE                                                                   |
1583 --|       Validates grade_ctl                                                |
1584 --|                                                                          |
1585 --|  DESCRIPTION                                                             |
1586 --|       This function validates that Grade Control must be either 0 or 1   |
1587 --|       and equal to 0 if lot_ctl = 0                                      |
1588 --|                                                                          |
1589 --|  PARAMETERS                                                              |
1590 --|       p_grade_ctl IN NUMBER - Grade Control Indicator                    |
1591 --|       p_lot_ctl   IN NUMBER - Lot Control Indicator                      |
1592 --|                                                                          |
1593 --|  RETURNS                                                                 |
1594 --|       TRUE  - If Grade Control contains a valid value                    |
1595 --|       FALSE - If Grade Control contains an invalid value                 |
1596 --|                                                                          |
1597 --|  HISTORY                                                                 |
1598 --|       11/13/1998 Mike Godfrey - Created                                  |
1599 --|                                                                          |
1600 --+==========================================================================+
1601 -- Func end of comments
1602 FUNCTION Validate_grade_ctl
1603 (  p_grade_ctl IN ic_item_mst.grade_ctl%TYPE
1604  , p_lot_ctl   IN ic_item_mst.lot_ctl%TYPE
1605 )
1606 RETURN BOOLEAN
1607 IS
1608 BEGIN
1609 
1610   IF (p_lot_ctl = 0 and p_grade_ctl <> 0)
1611   THEN
1612     RETURN FALSE;
1613   ELSE
1614     RETURN GMA_VALID_GRP.NumRangeCheck(  0
1615                                        , 1
1616                                        , p_grade_ctl
1617                                       );
1618   END IF;
1619 
1620 END Validate_grade_ctl;
1621 
1622 -- Func start of comments
1623 --+==========================================================================+
1624 --|  FUNCTION NAME                                                           |
1625 --|       Validate_status_ctl                                                |
1626 --|                                                                          |
1627 --|  USAGE                                                                   |
1628 --|       Validates status_ctl                                               |
1629 --|                                                                          |
1630 --|  DESCRIPTION                                                             |
1631 --|       This function validates that Status Control must be either 0 or 1  |
1632 --|       and equal to 0 if lot_ctl = 0                                      |
1633 --|                                                                          |
1634 --|  PARAMETERS                                                              |
1635 --|       p_status_ctl IN NUMBER - Status Control Indicator                  |
1636 --|       p_lot_ctl    IN NUMBER - Lot Control Indicator                     |
1637 --|                                                                          |
1638 --|  RETURNS                                                                 |
1639 --|       TRUE  - If Status Control contains a valid value                   |
1643 --|       11/13/1998 Mike Godfrey - Created                                  |
1640 --|       FALSE - If Status Control contains an invalid value                |
1641 --|                                                                          |
1642 --|  HISTORY                                                                 |
1644 --|                                                                          |
1645 --+==========================================================================+
1646 FUNCTION Validate_status_ctl
1647 (  p_status_ctl IN ic_item_mst.status_ctl%TYPE
1648  , p_lot_ctl    IN ic_item_mst.lot_ctl%TYPE
1649 )
1650 RETURN BOOLEAN
1651 IS
1652 BEGIN
1653 --B965832(1) Allow for status_ctl = NULL
1654   IF (p_lot_ctl = 0 and ((p_status_ctl <> 0) and (p_status_ctl IS NOT NULL)))
1655   THEN
1656     RETURN FALSE;
1657   ELSE
1658     RETURN GMA_VALID_GRP.NumRangeCheck(  0
1659 	                               , 2
1660                                        , p_status_ctl
1661                                       );
1662   END IF;
1663 
1664 END Validate_status_ctl;
1665 
1666 -- Func start of comments
1667 --+==========================================================================+
1668 --|  FUNCTION NAME                                                           |
1669 --|       Validate_qc_grade                                                  |
1670 --|                                                                          |
1671 --|  USAGE                                                                   |
1672 --|       Validates qc_grade                                                 |
1673 --|                                                                          |
1674 --|  DESCRIPTION                                                             |
1675 --|       This function validates that QC Grqde exists on qc_grad_mst        |
1676 --|       and is not blank if grade_ctl = 1                                  |
1677 --|                                                                          |
1678 --|  PARAMETERS                                                              |
1679 --|       p_qc_grade  IN VARCHAR2(4) - QC Grade Code                         |
1680 --|       p_grade_ctl IN NUMBER      - Grade Control Indicator               |
1681 --|                                                                          |
1682 --|  RETURNS                                                                 |
1683 --|       TRUE  - If QC Grade contains a valid value                         |
1684 --|       FALSE - If QC Grade contains an invalid value                      |
1685 --|                                                                          |
1686 --|  HISTORY                                                                 |
1687 --|       11/13/1998 Mike Godfrey - Created                                  |
1688 --|                                                                          |
1689 --+==========================================================================+
1690 FUNCTION Validate_qc_grade
1691 (   p_qc_grade  IN ic_item_mst.qc_grade%TYPE
1692   , p_grade_ctl IN ic_item_mst.grade_ctl%TYPE
1693 )
1694 RETURN BOOLEAN
1695 IS
1696 l_qc_grade ic_item_mst.qc_grade%TYPE;
1697 CURSOR qc_grad_mst_c1 IS
1698 SELECT
1699   qc_grade
1700 FROM
1701   qc_grad_mst
1702 WHERE
1703     qc_grad_mst.qc_grade    = p_qc_grade
1704 AND qc_grad_mst.delete_mark = 0;
1705 
1706 BEGIN
1707 
1708   IF (p_grade_ctl = 0)
1709   THEN
1710 --B965832(1) If grade_ctl=0, then set qc_grade to null
1711      l_qc_grade := '';
1712      RETURN TRUE;
1713 --B965832(1) End
1714   ELSIF (p_qc_grade = ' ' OR p_qc_grade IS NULL)
1715   THEN
1716     RETURN FALSE;
1717   END IF;
1718 
1719   OPEN qc_grad_mst_c1;
1720   FETCH qc_grad_mst_c1 INTO l_qc_grade;
1721   IF (qc_grad_mst_c1%NOTFOUND)
1722   THEN
1723     CLOSE qc_grad_mst_c1;
1724     RETURN FALSE;
1725   ELSE
1726     CLOSE qc_grad_mst_c1;
1727     RETURN TRUE;
1728   END IF;
1729 
1730 EXCEPTION
1731   WHEN OTHERS THEN
1732     RAISE;
1733 
1734 END Validate_qc_grade;
1735 
1736 -- Func start of comments
1737 --+==========================================================================+
1738 --|  FUNCTION NAME                                                           |
1739 --|       Validate_lot_status                                                |
1740 --|                                                                          |
1741 --|  USAGE                                                                   |
1742 --|       Validates lot_status                                               |
1743 --|                                                                          |
1744 --|  DESCRIPTION                                                             |
1745 --|       This function validates that Lot Status exists on ic_lots_sts      |
1746 --|       and is not blank if status_ctl = 1                                 |
1747 --|                                                                          |
1748 --|  PARAMETERS                                                              |
1749 --|       p_lot_status IN VARCHAR2(4) - Lot Status Code                      |
1750 --|       p_status_ctl IN NUMBER      - Lot Status Indicator                 |
1751 --|                                                                          |
1752 --|  RETURNS                                                                 |
1753 --|       TRUE  - If Lot Status contains a valid value                       |
1754 --|       FALSE - If Lot Status contains an invalid value                    |
1755 --|                                                                          |
1756 --|  HISTORY                                                                 |
1757 --|       11/13/1998 Mike Godfrey - Created                                  |
1758 --|                                                                          |
1759 --+==========================================================================+
1763 )
1760 FUNCTION Validate_lot_status
1761 (  p_lot_status IN ic_item_mst.lot_status%TYPE
1762  , p_status_ctl IN ic_item_mst.status_ctl%TYPE
1764 RETURN BOOLEAN
1765 IS
1766 l_lot_status ic_item_mst.lot_status%TYPE;
1767 CURSOR ic_lots_sts_c1 IS
1768 SELECT
1769   lot_status
1770 FROM
1771   ic_lots_sts
1772 WHERE
1773     ic_lots_sts.lot_status  = p_lot_status
1774 AND ic_lots_sts.delete_mark = 0;
1775 
1776 BEGIN
1777 
1778   IF (p_status_ctl = 0)
1779   THEN
1780 --B965832 Make sure that lot_status is set to null if status_ctl=0
1781       l_lot_status := '';
1782       RETURN TRUE;
1783   ELSIF (p_lot_status = ' ' OR p_lot_status IS NULL)
1784   THEN
1785     RETURN FALSE;
1786   END IF;
1787 
1788   OPEN ic_lots_sts_c1;
1789   FETCH ic_lots_sts_c1 INTO l_lot_status;
1790   IF (ic_lots_sts_c1%NOTFOUND)
1791   THEN
1792     CLOSE ic_lots_sts_c1;
1793     RETURN FALSE;
1794   ELSE
1795     CLOSE ic_lots_sts_c1;
1796     RETURN TRUE;
1797   END IF;
1798 
1799 EXCEPTION
1800   WHEN OTHERS THEN
1801     RAISE;
1802 
1803 END Validate_lot_status;
1804 
1805 -- Func start of comments
1806 --+==========================================================================+
1807 --|  FUNCTION NAME                                                           |
1808 --|       Validate_qchold_res_code                                           |
1809 --|                                                                          |
1810 --|  USAGE                                                                   |
1811 --|       Validates qchold_res_code                                          |
1812 --|                                                                          |
1813 --|  DESCRIPTION                                                             |
1814 --|       This function validates that QC Hold Reason Code exists on         |
1815 --|       qc_hres_mst                                                        |
1816 --|                                                                          |
1817 --|  PARAMETERS                                                              |
1818 --|       p_qchold_res_code IN VARCHAR2(4) - QC Hold reason Code             |
1819 --|       p_grade_ctl       IN NUMBER      - Lot Status Indicator            |
1820 --|                                                                          |
1821 --|  RETURNS                                                                 |
1822 --|       TRUE  - If QC Hold Reason Code contains a valid value              |
1823 --|       FALSE - If QC Hold reason Code contains an invalid value           |
1824 --|                                                                          |
1825 --|  HISTORY                                                                 |
1826 --|       11/13/1998 Mike Godfrey - Created                                  |
1827 --|                                                                          |
1828 --+==========================================================================+
1829 FUNCTION Validate_qchold_res_code
1830 (  p_qchold_res_code IN ic_item_mst.qchold_res_code%TYPE
1831  , p_grade_ctl       IN ic_item_mst.grade_ctl%TYPE
1832 )
1833 RETURN BOOLEAN
1834 IS
1835 l_qchold_res_code ic_item_mst.qchold_res_code%TYPE;
1836 CURSOR qc_hres_mst_c1 IS
1837 SELECT
1838   qchold_res_code
1839 FROM
1840   qc_hres_mst
1841 WHERE
1842     qc_hres_mst.qchold_res_code = p_qchold_res_code
1843 AND qc_hres_mst.delete_mark     = 0;
1844 
1845 BEGIN
1846 
1847   IF (p_qchold_res_code = ' ' OR p_qchold_res_code IS NULL)
1848   THEN
1849     RETURN TRUE;
1850   ELSIF (p_grade_ctl = 0)
1851   THEN
1852     RETURN FALSE;
1853   END IF;
1854 
1855   OPEN qc_hres_mst_c1;
1856 
1857   FETCH qc_hres_mst_c1 INTO l_qchold_res_code;
1858 
1859   IF (qc_hres_mst_c1%NOTFOUND)
1860   THEN
1861     CLOSE qc_hres_mst_c1;
1862     RETURN FALSE;
1863   ELSE
1864     CLOSE qc_hres_mst_c1;
1865     RETURN TRUE;
1866   END IF;
1867 
1868 EXCEPTION
1869   WHEN OTHERS THEN
1870     RAISE;
1871 
1872 END Validate_qchold_res_code;
1873 
1874 -- Func start of comments
1875 --+==========================================================================+
1876 --|  FUNCTION NAME                                                           |
1877 --|       Validate_expaction_code                                            |
1878 --|                                                                          |
1879 --|  USAGE                                                                   |
1880 --|       Validates expaction_code                                           |
1881 --|                                                                          |
1882 --|  DESCRIPTION                                                             |
1883 --|       This function validates that Expiration Code exists on             |
1884 --|       qc_actn_mst                                                        |
1885 --|                                                                          |
1886 --|  PARAMETERS                                                              |
1887 --|       p_expaction_code IN VARCHAR2(4) - Expiration Code                  |
1888 --|       p_grade_ctl      IN NUMBER      - Lot Status Indicator             |
1889 --|                                                                          |
1890 --|  RETURNS                                                                 |
1891 --|       TRUE  - If Expiration Code contains a valid value                  |
1892 --|       FALSE - If Expiration Code contains an invalid value               |
1893 --|                                                                          |
1894 --|  HISTORY                                                                 |
1895 --|       11/13/1998 Mike Godfrey - Created                                  |
1899 (  p_expaction_code IN ic_item_mst.expaction_code%TYPE
1896 --|                                                                          |
1897 --+==========================================================================+
1898 FUNCTION Validate_expaction_code
1900  , p_grade_ctl      IN ic_item_mst.grade_ctl%TYPE
1901 )
1902 RETURN BOOLEAN
1903 IS
1904 l_expaction_code ic_item_mst.expaction_code%TYPE;
1905 CURSOR qc_actn_mst_c1 IS
1906 SELECT
1907   action_code
1908 FROM
1909   qc_actn_mst
1910 WHERE
1911     qc_actn_mst.action_code = p_expaction_code
1912 AND qc_actn_mst.delete_mark = 0;
1913 
1914 BEGIN
1915 
1916   IF (p_expaction_code = ' ' OR p_expaction_code IS NULL)
1917   THEN
1918     RETURN TRUE;
1919   ELSIF (p_grade_ctl = 0)
1920   THEN
1921     RETURN FALSE;
1922   END IF;
1923 
1924   OPEN qc_actn_mst_c1;
1925 
1926   FETCH qc_actn_mst_c1 INTO l_expaction_code;
1927 
1928   IF (qc_actn_mst_c1%NOTFOUND)
1929   THEN
1930     CLOSE qc_actn_mst_c1;
1931     RETURN FALSE;
1932   ELSE
1933     CLOSE qc_actn_mst_c1;
1934     RETURN TRUE;
1935   END IF;
1936 
1937 EXCEPTION
1938   WHEN OTHERS THEN
1939     RAISE;
1940 
1941 END Validate_expaction_code;
1942 
1943 -- Func start of comments
1944 --+==========================================================================+
1945 --|  FUNCTION NAME                                                           |
1946 --|       Validate_expaction_interval                                        |
1947 --|                                                                          |
1948 --|  USAGE                                                                   |
1949 --|       Validates expaction_interval                                       |
1950 --|                                                                          |
1951 --|  DESCRIPTION                                                             |
1952 --|       This function validates that Expiration Interval is not negative   |
1953 --|       and not greater than 9999                                          |
1954 --|                                                                          |
1955 --|  PARAMETERS                                                              |
1956 --|       p_expaction_interval IN NUMBER - Expiration Code                   |
1957 --|       p_grade_ctl          IN NUMBER      - Lot Status Indicator         |
1958 --|                                                                          |
1959 --|  RETURNS                                                                 |
1960 --|       TRUE  - If Expiration Interval is positive or zero                 |
1961 --|       FALSE - If Expiration Interval is negative or > 9999               |
1962 --|                                                                          |
1963 --|  HISTORY                                                                 |
1964 --|       11/13/1998 Mike Godfrey - Created                                  |
1965 --|                                                                          |
1966 --+==========================================================================+
1967 FUNCTION Validate_expaction_interval
1968 (  p_expaction_interval IN ic_item_mst.expaction_interval%TYPE
1969  , p_grade_ctl          IN ic_item_mst.grade_ctl%TYPE
1970 )
1971 RETURN BOOLEAN
1972 IS
1973 BEGIN
1974 
1975   IF (p_expaction_interval = 0)
1976   THEN
1977     RETURN TRUE;
1978   ELSIF (p_grade_ctl = 0)
1979   THEN
1980     RETURN FALSE;
1981   END IF;
1982 
1983   IF (p_expaction_interval < 0 OR p_expaction_interval > 9999)
1984   THEN
1985     RETURN FALSE;
1986   END IF;
1987 
1988 END Validate_expaction_interval;
1989 
1990 -- Func start of comments
1991 --+==========================================================================+
1992 --|  FUNCTION NAME                                                           |
1993 --|       Validate_experimental_ind                                          |
1994 --|                                                                          |
1995 --|  USAGE                                                                   |
1996 --|       Validates experimental_ind                                         |
1997 --|                                                                          |
1998 --|  DESCRIPTION                                                             |
1999 --|       This function validates that Experimental Indicator is either      |
2000 --|       0 or 1                                                             |
2001 --|                                                                          |
2002 --|  PARAMETERS                                                              |
2003 --|       p_experimental_ind IN NUMBER - Expiration Code                     |
2004 --|                                                                          |
2005 --|  RETURNS                                                                 |
2006 --|       TRUE  - If Experimental Indicator contains a valid value           |
2007 --|       FALSE - If Experimental Indicator contains an invalid value        |
2008 --|                                                                          |
2009 --|  HISTORY                                                                 |
2010 --|       11/13/1998 Mike Godfrey - Created                                  |
2011 --|                                                                          |
2012 --+==========================================================================+
2013 FUNCTION Validate_experimental_ind
2014 ( p_experimental_ind IN ic_item_mst.experimental_ind%TYPE
2015 )
2016 RETURN BOOLEAN
2017 IS
2018 BEGIN
2019 
2020   RETURN GMA_VALID_GRP.NumRangeCheck(  0
2021                                      , 1
2022                                      , p_experimental_ind
2023                                     );
2024 
2025 END Validate_experimental_ind;
2026 
2030 --|       Validate_seq_dpnd_class                                            |
2027 -- Func start of comments
2028 --+==========================================================================+
2029 --|  FUNCTION NAME                                                           |
2031 --|                                                                          |
2032 --|  USAGE                                                                   |
2033 --|       Validates seq_dpnd_class                                           |
2034 --|                                                                          |
2035 --|  DESCRIPTION                                                             |
2036 --|       This function validates that Sequence Dependent Class exists       |
2037 --|       on cr_sqdt_cls                                                     |
2038 --|                                                                          |
2039 --|  PARAMETERS                                                              |
2040 --|       p_seq_dpnd_class IN VARCHAR2(8) - Sequence Dependent Class         |
2041 --|                                                                          |
2042 --|  RETURNS                                                                 |
2043 --|       TRUE  - If Sequence Dependent Class contains a valid value         |
2044 --|       FALSE - If Sequence Dependent Class contains an invalid value      |
2045 --|                                                                          |
2046 --|  HISTORY                                                                 |
2047 --|       11/13/1998 Mike Godfrey - Created                                  |
2048 --|                                                                          |
2049 --+==========================================================================+
2050 FUNCTION Validate_seq_dpnd_class
2051 ( p_seq_dpnd_class IN ic_item_mst.seq_dpnd_class%TYPE
2052 )
2053 RETURN BOOLEAN
2054 IS
2055 l_seq_dpnd_class ic_item_mst.seq_dpnd_class%TYPE;
2056 CURSOR cr_sqdt_cls_c1 IS
2057 SELECT
2058   seq_dpnd_class
2059 FROM
2060   cr_sqdt_cls
2061 WHERE
2062     cr_sqdt_cls.seq_dpnd_class = p_seq_dpnd_class
2063 AND cr_sqdt_cls.delete_mark    = 0;
2064 
2065 BEGIN
2066 
2067   OPEN cr_sqdt_cls_c1;
2068   FETCH cr_sqdt_cls_c1 INTO l_seq_dpnd_class;
2069   IF (cr_sqdt_cls_c1%NOTFOUND)
2070   THEN
2071     CLOSE cr_sqdt_cls_c1;
2072     RETURN FALSE;
2073   ELSE
2074     CLOSE cr_sqdt_cls_c1;
2075     RETURN TRUE;
2076   END IF;
2077 
2078 EXCEPTION
2079   WHEN OTHERS THEN
2080     RAISE;
2081 
2082 END Validate_seq_dpnd_class;
2083 
2084 -- Func start of comments
2085 --+==========================================================================+
2086 --|  FUNCTION NAME                                                           |
2087 --|       Validate_commodity_code                                            |
2088 --|                                                                          |
2089 --|  USAGE                                                                   |
2090 --|       Validates commodity_code                                           |
2091 --|                                                                          |
2092 --|  DESCRIPTION                                                             |
2093 --|       This function validates that Commodity Code exists on              |
2094 --|       ic_comd_cds and it is non blank if SY$INTRASTAT = 1                |
2095 --|                                                                          |
2096 --|  PARAMETERS                                                              |
2097 --|       p_commodity_code IN VARCHAR2(9)  - Commodity Code                  |
2098 --|       p_sy$intrast     IN VARCHAR2(40) - Intrastat Indicator             |
2099 --|                                                                          |
2100 --|  RETURNS                                                                 |
2101 --|       TRUE  - If Commodity Code contains a valid value                   |
2102 --|       FALSE - If commodity Code contains an invalid value                |
2103 --|                                                                          |
2104 --|  HISTORY                                                                 |
2105 --|       11/13/1998 Mike Godfrey - Created                                  |
2106 --|                                                                          |
2107 --+==========================================================================+
2108 FUNCTION Validate_commodity_code
2109 (  p_commodity_code IN ic_item_mst.commodity_code%TYPE
2110  , p_sy$intrastat   IN VARCHAR2
2111 )
2112 RETURN BOOLEAN
2113 IS
2114 l_commodity_code ic_item_mst.commodity_code%TYPE;
2115 CURSOR ic_comd_cds_c1 IS
2116 SELECT
2117   commodity_code
2118 FROM
2119   ic_comd_cds
2120 WHERE
2121     ic_comd_cds.commodity_code = p_commodity_code
2122 AND ic_comd_cds.delete_mark    = 0;
2123 
2124 BEGIN
2125 
2126   IF (p_commodity_code = ' ' OR p_commodity_code IS NULL) AND
2127      (p_sy$intrastat <> 1)
2128   THEN
2129     RETURN TRUE;
2130   ELSIF (p_commodity_code = ' ' OR p_commodity_code IS NULL) AND
2131          (p_sy$intrastat = 1)
2132   THEN
2133     RETURN FALSE;
2134   END IF;
2135 
2136   OPEN ic_comd_cds_c1;
2137   FETCH ic_comd_cds_c1 INTO l_commodity_code;
2138   IF (ic_comd_cds_c1%NOTFOUND)
2139   THEN
2140     CLOSE ic_comd_cds_c1;
2141     RETURN FALSE;
2142   ELSE
2143     CLOSE ic_comd_cds_c1;
2144     RETURN TRUE;
2145   END IF;
2146 
2147 EXCEPTION
2148   WHEN OTHERS THEN
2149     RAISE;
2150 
2151 END Validate_commodity_code;
2152 
2153 -- Func start of comments
2154 --+==========================================================================+
2155 --|  FUNCTION NAME                                                           |
2159 --|       Validates ic_matr_days                                             |
2156 --|       Validate_ic_matr_days                                              |
2157 --|                                                                          |
2158 --|  USAGE                                                                   |
2160 --|                                                                          |
2161 --|  DESCRIPTION                                                             |
2162 --|       This function validates that Mature days is not a negative value   |
2163 --|                                                                          |
2164 --|  PARAMETERS                                                              |
2165 --|       p_ic_matr_days IN NUMBER - Mature days                             |
2166 --|                                                                          |
2167 --|  RETURNS                                                                 |
2168 --|       TRUE  - If Mature Days is greater or equal to zero                 |
2169 --|       FALSE - If Mature days is negative                                 |
2170 --|                                                                          |
2171 --|  HISTORY                                                                 |
2172 --|       11/13/1998 Mike Godfrey - Created                                  |
2173 --|                                                                          |
2174 --+==========================================================================+
2175 FUNCTION Validate_ic_matr_days
2176 ( p_ic_matr_days IN ic_item_cpg.ic_matr_days%TYPE
2177 )
2178 RETURN BOOLEAN
2179 IS
2180 l_ic_matr_days  ic_item_cpg.ic_matr_days%TYPE;
2181 BEGIN
2182 
2183   l_ic_matr_days  := p_ic_matr_days;
2184   RETURN GMA_VALID_GRP.NumRangeCheck( 0, 99999, l_ic_matr_days);
2185 
2186 END Validate_ic_matr_days;
2187 
2188 -- Func start of comments
2189 --+==========================================================================+
2190 --|  FUNCTION NAME                                                           |
2191 --|       Validate_ic_hold_days                                              |
2192 --|                                                                          |
2193 --|  USAGE                                                                   |
2194 --|       Validates ic_holr_days                                             |
2195 --|                                                                          |
2196 --|  DESCRIPTION                                                             |
2197 --|       This function validates that Hold days is not a negative value     |
2198 --|                                                                          |
2199 --|  PARAMETERS                                                              |
2200 --|       p_ic_hold_days IN NUMBER - Hold days                               |
2201 --|                                                                          |
2202 --|  RETURNS                                                                 |
2203 --|       TRUE  - If Hold Days is greater or equal to zero                   |
2204 --|       FALSE - If Hold days is negative                                   |
2205 --|                                                                          |
2206 --|  HISTORY                                                                 |
2207 --|       11/13/1998 Mike Godfrey - Created                                  |
2208 --|                                                                          |
2209 --+==========================================================================+
2210 FUNCTION Validate_ic_hold_days
2211 ( p_ic_hold_days IN ic_item_cpg.ic_hold_days%TYPE
2212 )
2213 RETURN BOOLEAN
2214 IS
2215 l_ic_hold_days  ic_item_cpg.ic_hold_days%TYPE;
2216 BEGIN
2217 
2218   l_ic_hold_days  := p_ic_hold_days;
2219   RETURN GMA_VALID_GRP.NumRangeCheck( 0, 99999, l_ic_hold_days);
2220 
2221 END Validate_ic_hold_days;
2222 
2223 -- Func start of comments
2224 --+==========================================================================+
2225 --|  FUNCTION NAME                                                           |
2226 --|       Validate_Strength                                                  |
2227 --|                                                                          |
2228 --|  USAGE                                                                   |
2229 --|       Validates strength                                                 |
2230 --|                                                                          |
2231 --|  DESCRIPTION                                                             |
2232 --|       This function validates that Strength is not a negative value      |
2233 --|                                                                          |
2234 --|  PARAMETERS                                                              |
2235 --|       p_strength IN NUMBER - Strength                                    |
2236 --|                                                                          |
2237 --|  RETURNS                                                                 |
2238 --|       TRUE  - If Strength is greater or equal to zero                    |
2239 --|       FALSE - If Strength is negative                                    |
2240 --|                                                                          |
2241 --|  HISTORY                                                                 |
2242 --|       11/13/1998 Mike Godfrey - Created                                  |
2243 --|                                                                          |
2244 --+==========================================================================+
2245 FUNCTION Validate_Strength
2246 ( p_strength IN ic_lots_mst.strength%TYPE
2247 )
2248 RETURN BOOLEAN
2249 IS
2250 BEGIN
2251 
2252   IF (p_strength < 0)
2253   THEN
2254     RETURN FALSE;
2255   ELSE
2256     RETURN TRUE;
2257   END IF;
2258 
2259 END Validate_strength;
2260 
2261 -- Func start of comments
2265 --|                                                                          |
2262 --+==========================================================================+
2263 --|  FUNCTION NAME                                                           |
2264 --|       Validate_origination_type                                          |
2266 --|  USAGE                                                                   |
2267 --|       Validates origination_type                                         |
2268 --|                                                                          |
2269 --|  DESCRIPTION                                                             |
2270 --|       This function validates that Origination Type exists on            |
2271 --|       gem_lookups                                                        |
2272 --|                                                                          |
2273 --|  PARAMETERS                                                              |
2274 --|       p_origination_type IN NUMBER - Origination Type                    |
2275 --|                                                                          |
2276 --|  RETURNS                                                                 |
2277 --|       TRUE  - If Origination Type contains a valid value                 |
2278 --|       FALSE - If Origination Type contains an invalid value              |
2279 --|                                                                          |
2280 --|  HISTORY                                                                 |
2281 --|       11/13/1998 Mike Godfrey - Created                                  |
2282 --|                                                                          |
2283 --+==========================================================================+
2284 FUNCTION Validate_origination_type
2285 ( p_origination_type IN ic_lots_mst.origination_type%TYPE
2286 )
2287 RETURN BOOLEAN
2288 IS
2289 l_origination_type ic_lots_mst.origination_type%TYPE;
2290 CURSOR gem_lookups_c1 IS
2291 SELECT
2292   lookup_type
2293 FROM
2294   gem_lookups
2295 WHERE
2296   lookup_type   = 'ORIGINATION_TYPE'
2297 AND lookup_code = p_origination_type;
2298 
2299 BEGIN
2300 
2301   OPEN gem_lookups_c1;
2302   FETCH gem_lookups_c1 INTO l_origination_type;
2303   IF (gem_lookups_c1%NOTFOUND)
2304   THEN
2305     CLOSE gem_lookups_c1;
2306     RETURN FALSE;
2307   ELSE
2308     CLOSE gem_lookups_c1;
2309     RETURN TRUE;
2310   END IF;
2311 
2312 EXCEPTION
2313   WHEN OTHERS THEN
2314     RAISE;
2315 
2316 END Validate_origination_type;
2317 
2318 -- Func start of comments
2319 --+==========================================================================+
2320 --|  FUNCTION NAME                                                           |
2321 --|       Validate_shipvendor_no                                             |
2322 --|                                                                          |
2323 --|  USAGE                                                                   |
2324 --|       Validates shipvendor_no                                            |
2325 --|                                                                          |
2326 --|  DESCRIPTION                                                             |
2327 --|       This function validates that Vendor exists on po_vend_mst          |
2328 --|                                                                          |
2329 --|  PARAMETERS                                                              |
2330 --|       p_shipvendor_no IN VARCHAR2(32) - Ship Vendor Code                 |
2331 --|                                                                          |
2332 --|  RETURNS                                                                 |
2333 --|       TRUE  - If Ship Vendor Code contains a valid value                 |
2334 --|       FALSE - If Ship Vendor Code contains an invalid value              |
2335 --|                                                                          |
2336 --|  HISTORY                                                                 |
2337 --|       11/13/1998 Mike Godfrey - Created                                  |
2338 --|                                                                          |
2339 --+==========================================================================+
2340 FUNCTION Validate_shipvendor_no
2341 ( p_shipvendor_no IN po_vend_mst.vendor_no%TYPE
2342 )
2343 RETURN NUMBER
2344 IS
2345 l_shipvendor_no po_vend_mst.vendor_no%TYPE;
2346 l_shipvendor_id ic_lots_mst.shipvend_id%TYPE;
2347 
2348 CURSOR po_vend_mst_c1 IS
2349 SELECT
2350   vendor_no
2351 , vendor_id
2352 FROM
2353   po_vend_mst
2354 WHERE
2355     vendor_no   = p_shipvendor_no
2356 AND delete_mark = 0;
2357 
2358 BEGIN
2359 
2360   IF (p_shipvendor_no = ' ' OR p_shipvendor_no IS NULL)
2361   THEN
2362     RETURN 0;
2363   ELSE
2364     OPEN po_vend_mst_c1;
2365     FETCH po_vend_mst_c1 INTO l_shipvendor_no, l_shipvendor_id;
2366     IF (po_vend_mst_c1%NOTFOUND)
2367     THEN
2368       CLOSE po_vend_mst_c1;
2369       RETURN 0;
2370     ELSE
2371       CLOSE po_vend_mst_c1;
2372       RETURN l_shipvendor_id;
2373     END IF;
2374   END IF;
2375 
2376 EXCEPTION
2377   WHEN OTHERS THEN
2378     RAISE;
2379 
2380 END Validate_shipvendor_no;
2381 
2382 -- Func start of comments
2383 --+==========================================================================+
2384 --|  FUNCTION NAME                                                           |
2385 --|       Validate_lot_no                                                    |
2386 --|                                                                          |
2387 --|  USAGE                                                                   |
2388 --|       Validates Lot and Sub-Lot numbers against item number              |
2389 --|                                                                          |
2393 --|                                                                          |
2390 --|  DESCRIPTION                                                             |
2391 --|       This function validates that the Item/Lot/Sublot combination       |
2392 --|       exists                                                             |
2394 --|  PARAMETERS                                                              |
2395 --|       p_item_no    IN VARCHAR2(32) - Item Number                         |
2396 --|       p_lot_no     IN VARCHAR2(32) - Lot Number                          |
2397 --|       p_sublot_no  IN VARCHAR2(32) - Sub-Lot Number                      |
2398 --|                                                                          |
2399 --|  RETURNS                                                                 |
2400 --|       TRUE  - If Item/lot/sublot is a valid combination                  |
2401 --|       FALSE - If Item/lot/sublot is not a valid combination              |
2402 --|                                                                          |
2403 --|  HISTORY                                                                 |
2404 --|       11/13/1998 Mike Godfrey - Created                                  |
2405 --|                                                                          |
2406 --+==========================================================================+
2407 FUNCTION Validate_lot_No
2408 (  p_item_no   IN ic_item_mst.item_no%TYPE
2409  , p_lot_no    IN ic_lots_mst.lot_no%TYPE
2410  , p_sublot_no IN ic_lots_mst.sublot_no%TYPE
2411 )
2412 RETURN BOOLEAN
2413 IS
2414 l_item_id   ic_item_mst.item_id%TYPE;
2415 l_item_no   ic_item_mst.item_no%TYPE;
2416 l_lot_no    ic_lots_mst.lot_no%TYPE;
2417 l_sublot_no ic_lots_mst.sublot_no%TYPE;
2418 
2419 CURSOR ic_lots_mst_c1 IS
2420 SELECT
2421   a.item_no
2422 , a.item_id
2423 , b.lot_no
2424 , b.sublot_no
2425 FROM
2426   ic_item_mst a
2427 , ic_lots_mst b
2428 WHERE
2429     p_item_no     = a.item_no
2430 AND a.item_id     = b.item_id
2431 AND p_lot_no      = b.lot_no
2432 AND p_sublot_no   = b.sublot_no
2433 AND b.delete_mark = 0;
2434 
2435 BEGIN
2436 
2437   OPEN ic_lots_mst_c1;
2438   FETCH ic_lots_mst_c1 INTO l_item_no, l_item_id, l_lot_no, l_sublot_no;
2439   IF (ic_lots_mst_c1%NOTFOUND)
2440   THEN
2441     CLOSE ic_lots_mst_c1;
2442     RETURN FALSE;
2443   ELSE
2444     CLOSE ic_lots_mst_c1;
2445     RETURN TRUE;
2446   END IF;
2447 
2448 EXCEPTION
2449   WHEN OTHERS THEN
2450     RAISE;
2451 
2452 END Validate_lot_no;
2453 
2454 -- Func start of comments
2455 --+==========================================================================+
2456 --|  FUNCTION NAME                                                           |
2457 --|       Validate_location                                                  |
2458 --|                                                                          |
2459 --|  USAGE                                                                   |
2460 --|       Validates Location                                                 |
2461 --|                                                                          |
2462 --|  DESCRIPTION                                                             |
2463 --|       This function validates whether or not a location is required for  |
2464 --|       an item/warehouse. If required then validates the location if      |
2465 --|       required                                                           |
2466 --|                                                                          |
2467 --|  PARAMETERS                                                              |
2468 --|       p_item_loct_ctl IN NUMBER       - Item Location Control Indicator  |
2469 --|       p_whse_loct_ctl IN NUMBER       - Warehouse Location Control Ind   |
2470 --|       p_whse_code     IN VARCHAR2(4)  - Warehouse Code                   |
2471 --|       p_location      IN VARCHAR2(16) - Location Code                    |
2472 --|                                                                          |
2473 --|  RETURNS                                                                 |
2474 --|       TRUE  - If Location Code contains a valid value                    |
2475 --|       FALSE - If Location Code contains an invalid value                 |
2476 --|                                                                          |
2477 --|  HISTORY                                                                 |
2478 --|       11/13/1998 Mike Godfrey - Created                                  |
2479 --|                                                                          |
2480 --+==========================================================================+
2481 FUNCTION Validate_Location
2482 (  p_item_loct_ctl IN ic_item_mst.loct_ctl%TYPE
2483  , p_whse_loct_ctl IN ic_whse_mst.loct_ctl%TYPE
2484  , p_whse_code     IN ic_whse_mst.whse_code%TYPE
2485  , p_location      IN ic_loct_mst.location%TYPE
2486 )
2487 RETURN BOOLEAN
2488 IS
2489 l_loct_ctl         NUMBER;
2490 l_location         ic_loct_mst.location%TYPE;
2491 CURSOR ic_loct_mst_c1 IS
2492 SELECT
2493   location
2494 FROM
2495   ic_loct_mst
2496 WHERE
2497     whse_code   = p_whse_code
2498 AND location    = p_location
2499 AND delete_mark = 0;
2500 
2501 BEGIN
2502 
2503 -- determine location control for item / whse combination
2504   l_loct_ctl := p_item_loct_ctl * p_whse_loct_ctl;
2505 
2506 -- location not required
2507   IF (l_loct_ctl = 0)
2508   THEN
2509     IF (p_location <> ' ' AND p_location IS NOT NULL)
2510     THEN
2511       RETURN FALSE;
2512     ELSE
2513       RETURN TRUE;
2514     END IF;
2515   END IF;
2516 
2517 -- location required but not validated
2518   IF (l_loct_ctl > 1)
2519   THEN
2520     IF (p_location = ' ' OR p_location IS NULL)
2521     THEN
2522       RETURN FALSE;
2523     ELSE
2527 
2524       RETURN TRUE;
2525     END IF;
2526   END IF;
2528 -- validated location required
2529   OPEN ic_loct_mst_c1;
2530   FETCH ic_loct_mst_c1 INTO l_location;
2531   IF (ic_loct_mst_c1%NOTFOUND)
2532   THEN
2533     CLOSE ic_loct_mst_c1;
2534     RETURN FALSE;
2535   ELSE
2536     CLOSE ic_loct_mst_c1;
2537     RETURN TRUE;
2538   END IF;
2539 
2540 EXCEPTION
2541   WHEN OTHERS THEN
2542     RAISE;
2543 
2544 END Validate_Location;
2545 
2546 -- Func start of comments
2547 --+==========================================================================+
2548 --|  FUNCTION NAME                                                           |
2549 --|       Validate_item_cnv                                                  |
2550 --|                                                                          |
2551 --|  USAGE                                                                   |
2552 --|       Validates Item / Lot conversion exists                             |
2553 --|                                                                          |
2554 --|  DESCRIPTION                                                             |
2555 --|       This function validates that the combination of parameters passed  |
2556 --|       exists on ic_item_cnv                                              |
2557 --|                                                                          |
2558 --|  PARAMETERS                                                              |
2559 --|       p_item_no   IN VARCHAR2(32) - Item Number                          |
2560 --|       p_lot_no    IN VARCHAR2(32) - Lot Number                           |
2561 --|       p_sublot_no IN VARCHAR2(32) - Sub-Lot Number                       |
2562 --|       p_um_type   IN VARCHAR2(4)  - UoM Type                             |
2563 --|                                                                          |
2564 --|  RETURNS                                                                 |
2565 --|       TRUE  - If Item/Lot/Sublot conversion exists                       |
2566 --|       FALSE - If Item/Lot/Sublot conversion does not exist               |
2567 --|                                                                          |
2568 --|  HISTORY                                                                 |
2569 --|       11/13/1998 Mike Godfrey - Created                                  |
2570 --|                                                                          |
2571 --+==========================================================================+
2572 FUNCTION Validate_item_cnv
2573 (  p_item_no   IN ic_item_mst.item_no%TYPE
2574  , p_lot_no    IN ic_lots_mst.lot_no%TYPE
2575  , p_sublot_no IN ic_lots_mst.sublot_no%TYPE
2576  , p_um_type   IN ic_item_cnv.um_type%TYPE
2577 )
2578 RETURN BOOLEAN
2579 IS
2580 l_item_no ic_item_mst.item_no%TYPE;
2581 
2582 CURSOR ic_item_cnv_c1 IS
2583 SELECT
2584   a.item_no
2585 FROM
2586   ic_item_mst a
2587 , ic_lots_mst b
2588 , ic_item_cnv c
2589 WHERE
2590     p_item_no     = a.item_no
2591 AND a.item_id     = b.item_id
2592 AND p_lot_no      = b.lot_no
2593 AND p_sublot_no   = b.sublot_no
2594 AND b.delete_mark = 0
2595 AND c.item_id     = a.item_id
2596 AND c.lot_id      = b.lot_id
2597 AND c.um_type     = p_um_type;
2598 
2599 BEGIN
2600 
2601   OPEN ic_item_cnv_c1;
2602   FETCH ic_item_cnv_c1 INTO l_item_no;
2603   IF (ic_item_cnv_c1%NOTFOUND)
2604   THEN
2605     CLOSE ic_item_cnv_c1;
2606     RETURN FALSE;
2607   ELSE
2608     CLOSE ic_item_cnv_c1;
2609     RETURN TRUE;
2610   END IF;
2611 
2612 EXCEPTION
2613   WHEN OTHERS THEN
2614     RAISE;
2615 
2616 END Validate_item_cnv;
2617 
2618 END GMI_VALID_GRP;