DBA Data[Home] [Help]

PACKAGE BODY: APPS.PO_HAZARD_CLASSES_SV1

Source


1 PACKAGE BODY PO_HAZARD_CLASSES_SV1 AS
2 /* $Header: POXPIHCB.pls 120.0.12000000.1 2007/07/27 09:07:04 grohit noship $ */
3 
4 /*================================================================
5 
6   FUNCTION NAME: 	val_hazard_class_id()
7 
8 ==================================================================*/
9  FUNCTION val_hazard_class_id(x_hazard_class_id IN NUMBER) RETURN BOOLEAN
10  IS
11 
12    x_progress    varchar2(3) := null;
13    x_temp        binary_integer := 0;
14 
15  BEGIN
16    x_progress := '010';
17 
18    /* check to see if there are x_hazard_class_id exists in
19       po_hazard_classes_val_v table */
20 
21    SELECT count(*)
22      INTO x_temp
23      FROM po_hazard_classes_val_v
24     WHERE hazard_class_id = x_hazard_class_id;
25 
26    IF x_temp = 0 THEN
27       RETURN FALSE;       /* validation fails */
28    ELSE
29       RETURN TRUE;        /* validation succeeds */
30    END IF;
31 
32  EXCEPTION
33    WHEN others THEN
34         po_message_s.sql_error
35         ('val_hazard_class_id', x_progress, sqlcode);
36         raise;
37  END val_hazard_class_id;
38 
39 
40 /*================================================================
41 
42   FUNCTION NAME: 	derive_hazard_class_id()
43 
44 ==================================================================*/
45 FUNCTION  derive_hazard_class_id(X_hazard_class IN VARCHAR2)
46                                return NUMBER IS
47 
48 X_progress       varchar2(3)     := NULL;
49 X_hazard_class_id_v number        := NULL;
50 
51 BEGIN
52 
53  X_progress := '010';
54 
55   /* get the hazardclass_id from po_hazard_class_val_v table
56       based on hazard_class which is provided from input para. */
57 
58  SELECT hazard_class_id
59  INTO X_hazard_class_id_v
60  FROM po_hazard_classes_val_v
61  WHERE hazard_class = X_hazard_class;
62 
63  RETURN X_hazard_class_id_v;
64 
65 EXCEPTION
66 
67    When no_data_found then
68      RETURN NULL;
69    When others then
70      po_message_s.sql_error('derive_hazard_class_id',X_progress, sqlcode);
71    raise;
72 
73 END derive_hazard_class_id;
74 END PO_HAZARD_CLASSES_SV1;