1 package body PA_COST_BASE_EXP_TYPES_PKG as
2 -- $Header: PAXCICEB.pls 120.1 2005/08/23 19:19:37 spunathi noship $
3
4 -- constant
5 NO_DATA_FOUND_ERR constant number := 100;
6
7 ------------------------------------------------------------------------------
8 procedure check_unique(cp_structure IN varchar2,
9 c_base_type IN varchar2,
10 exp_type IN varchar2,
11 status IN OUT NOCOPY number)
12 is
13 dummy number;
14 begin
15
16 status := 0;
17
18 SELECT 1 INTO dummy FROM sys.dual WHERE NOT EXISTS
19 (SELECT 1 FROM pa_cost_base_exp_types
20 WHERE cost_base_type = c_base_type
21 AND cost_plus_structure = cp_structure
22 AND expenditure_type = exp_type);
23
24 exception
25
26 when NO_DATA_FOUND then
27 status := NO_DATA_FOUND_ERR;
28
29 when OTHERS then
30 status := SQLCODE;
31
32 end check_unique;
33
34 ------------------------------------------------------------------------------
35 --
36 -- PROCEDURE
37 -- check_structure_used
38 --
39 -- PURPOSE
40 -- The objective of this procedure is to check whether the
41 -- cost plus structure has been used. 'Used' is defined as
42 -- there are costed expenditure items in this cost plus structure.
43 --
44 -- HISTORY
45 --
46 -- 07-MAY-94 S Lee Created
47 --
48
49 procedure check_structure_used(structure IN varchar2,
50 status IN OUT NOCOPY number,
51 stage IN OUT NOCOPY number)
52 is
53 -- cursor definition
54
55 CURSOR rev_cursor
56 IS
57 SELECT ind_rate_sch_revision_id
58 FROM pa_ind_rate_sch_revisions
59 WHERE cost_plus_structure = structure;
60
61 BEGIN
62
63 status := 0;
64
65 FOR rev_row IN rev_cursor LOOP
66
67 pa_cost_plus.check_revision_used(rev_row.ind_rate_sch_revision_id,
68 status,
69 stage);
70
71 if (status <> 0) then
72 stage := 100;
73 EXIT;
74 end if;
75
76 END LOOP;
77
78 EXCEPTION
79 WHEN OTHERS THEN
80 stage := 100;
81
82 END check_structure_used;
83
84 ------------------------------------------------------------------------------
85 procedure get_description(exp_type IN varchar2, descpt IN OUT NOCOPY varchar2) is
86 begin
87
88 SELECT description INTO descpt FROM pa_expenditure_types
89 WHERE expenditure_type = exp_type;
90
91 exception
92 when OTHERS then
93 descpt := null;
94
95 end get_description;
96
97 end PA_COST_BASE_EXP_TYPES_PKG ;