1 Package Body IRC_PROF_AREA_CRITERIA_VAL_API as
2 /* $Header: irpcvapi.pkb 120.0 2005/10/03 14:58:56 rbanda noship $ */
3 --
4 -- Package Variables
5 --
6 g_package varchar2(33) := ' IRC_PROF_AREA_CRITERIA_VAL_API.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |-------------------< CREATE_PROF_AREA_CRITERIA >---------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure CREATE_PROF_AREA_CRITERIA
13 (p_validate in boolean default false
14 ,p_effective_date in date
15 ,p_search_criteria_id in number
16 ,p_professional_area in varchar2
17 ,p_prof_area_criteria_value_id out nocopy number
18 ,p_object_version_number out nocopy number
19 ) is
20 --
21 -- Declare cursors and local variables
22 --
23 l_proc varchar2(72) := g_package||'CREATE_PROF_AREA_CRITERIA';
24 l_effective_date date;
25 l_object_version_number irc_prof_area_criteria_values.object_version_number%TYPE;
26 l_prof_area_criteria_value_id irc_prof_area_criteria_values.prof_area_criteria_value_id%TYPE;
27
28 begin
29 hr_utility.set_location('Entering:'|| l_proc, 10);
30 --
31 -- Issue a savepoint
32 --
33 savepoint CREATE_PROF_AREA_CRITERIA;
34 --
35 -- Truncate the time portion from all IN date parameters
36 --
37 l_effective_date := trunc(p_effective_date);
38 --
39 -- Call Before Process User Hook
40 --
41 begin
42 IRC_PROF_AREA_CRITERIA_VAL_BK1.CREATE_PROF_AREA_CRITERIA_B
43 (p_effective_date => l_effective_date
44 ,p_search_criteria_id => p_search_criteria_id
45 ,p_professional_area => p_professional_area
46 );
47 exception
48 when hr_api.cannot_find_prog_unit then
49 hr_api.cannot_find_prog_unit_error
50 (p_module_name => 'CREATE_PROF_AREA_CRITERIA'
51 ,p_hook_type => 'BP'
52 );
53 end;
54 --
55 -- Validation in addition to Row Handlers
56 --
57 --
58 -- Process Logic
59 --
60 irc_pcv_ins.ins
61 (p_effective_date => l_effective_date
62 ,p_search_criteria_id => p_search_criteria_id
63 ,p_professional_area => p_professional_area
64 ,p_prof_area_criteria_value_id => l_prof_area_criteria_value_id
65 ,p_object_version_number => l_object_version_number
66 );
67 --
68 -- Call After Process User Hook
69 --
70 begin
71 IRC_PROF_AREA_CRITERIA_VAL_BK1.CREATE_PROF_AREA_CRITERIA_A
72 (p_effective_date => l_effective_date
73 ,p_prof_area_criteria_value_id => l_prof_area_criteria_value_id
74 ,p_search_criteria_id => p_search_criteria_id
75 ,p_professional_area => p_professional_area
76 ,p_object_version_number => l_object_version_number
77 );
78 exception
79 when hr_api.cannot_find_prog_unit then
80 hr_api.cannot_find_prog_unit_error
81 (p_module_name => 'CREATE_PROF_AREA_CRITERIA'
82 ,p_hook_type => 'AP'
83 );
84 end;
85 --
86 -- When in validation only mode raise the Validate_Enabled exception
87 --
88 if p_validate then
89 raise hr_api.validate_enabled;
90 end if;
91 --
92 -- Set all IN OUT and OUT parameters with out values
93 --
94 p_prof_area_criteria_value_id := l_prof_area_criteria_value_id;
95 p_object_version_number := l_object_version_number;
96 --
97 hr_utility.set_location(' Leaving:'||l_proc, 70);
98 exception
99 when hr_api.validate_enabled then
100 --
101 -- As the Validate_Enabled exception has been raised
102 -- we must rollback to the savepoint
103 --
104 rollback to CREATE_PROF_AREA_CRITERIA;
105 --
106 -- Reset IN OUT parameters and set OUT parameters
107 -- (Any key or derived arguments must be set to null
108 -- when validation only mode is being used.)
109 --
110 p_prof_area_criteria_value_id := null;
111 p_object_version_number := null;
112 hr_utility.set_location(' Leaving:'||l_proc, 80);
113 when others then
114 --
115 -- A validation or unexpected error has occured
116 --
117 rollback to CREATE_PROF_AREA_CRITERIA;
118 --
119 -- Reset IN OUT parameters and set all
120 -- OUT parameters, including warnings, to null
121 --
122 p_prof_area_criteria_value_id := null;
123 p_object_version_number := null;
124 hr_utility.set_location(' Leaving:'||l_proc, 90);
125 raise;
126 end CREATE_PROF_AREA_CRITERIA;
127 --
128 -- ----------------------------------------------------------------------------
129 -- |-----------------< DELETE_PROF_AREA_CRITERIA >-----------------------|
130 -- ----------------------------------------------------------------------------
131 --
132 procedure DELETE_PROF_AREA_CRITERIA
133 (p_validate in boolean default false
134 ,p_prof_area_criteria_value_id in number
135 ,p_object_version_number in number
136 ) is
137 --
138 -- Declare cursors and local variables
139 --
140 l_proc varchar2(72) := g_package||'DELETE_PROF_AREA_CRITERIA';
141 begin
142 hr_utility.set_location('Entering:'|| l_proc, 10);
143 --
144 -- Issue a savepoint
145 --
146 savepoint DELETE_PROF_AREA_CRITERIA;
147 --
148 -- Call Before Process User Hook
149 --
150 begin
151 IRC_PROF_AREA_CRITERIA_VAL_BK2.DELETE_PROF_AREA_CRITERIA_B
152 (p_prof_area_criteria_value_id => p_prof_area_criteria_value_id
153 ,p_object_version_number => p_object_version_number
154 );
155 exception
156 when hr_api.cannot_find_prog_unit then
157 hr_api.cannot_find_prog_unit_error
158 (p_module_name => 'DELETE_PROF_AREA_CRITERIA'
159 ,p_hook_type => 'BP'
160 );
161 end;
162 --
163 -- Validation in addition to Row Handlers
164 --
165 --
166 -- Process Logic
167 --
168 irc_pcv_del.del
169 (p_prof_area_criteria_value_id => p_prof_area_criteria_value_id
170 ,p_object_version_number => p_object_version_number
171 );
172 --
173 -- Call After Process User Hook
174 --
175 begin
176 IRC_PROF_AREA_CRITERIA_VAL_BK2.DELETE_PROF_AREA_CRITERIA_A
177 (p_prof_area_criteria_value_id => p_prof_area_criteria_value_id
178 ,p_object_version_number => p_object_version_number
179 );
180 exception
181 when hr_api.cannot_find_prog_unit then
182 hr_api.cannot_find_prog_unit_error
183 (p_module_name => 'DELETE_PROF_AREA_CRITERIA'
184 ,p_hook_type => 'AP'
185 );
186 end;
187 --
188 -- When in validation only mode raise the Validate_Enabled exception
189 --
190 if p_validate then
191 raise hr_api.validate_enabled;
192 end if;
193 --
194 -- Set all IN OUT and OUT parameters with out values
195 --
196 hr_utility.set_location(' Leaving:'||l_proc, 70);
197 exception
198 when hr_api.validate_enabled then
199 --
200 -- As the Validate_Enabled exception has been raised
201 -- we must rollback to the savepoint
202 --
203 rollback to DELETE_PROF_AREA_CRITERIA;
204 --
205 -- Reset IN OUT parameters and set OUT parameters
206 -- (Any key or derived arguments must be set to null
207 -- when validation only mode is being used.)
208 --
209 hr_utility.set_location(' Leaving:'||l_proc, 80);
210 when others then
211 --
212 -- A validation or unexpected error has occured
213 --
214 rollback to DELETE_PROF_AREA_CRITERIA;
215 --
216 -- Reset IN OUT parameters and set all
217 -- OUT parameters, including warnings, to null
218 --
219 hr_utility.set_location(' Leaving:'||l_proc, 90);
220 raise;
221 end DELETE_PROF_AREA_CRITERIA;
222 --
223 end IRC_PROF_AREA_CRITERIA_VAL_API;