[Home] [Help]
PACKAGE BODY: APPS.GHR_NRE_SHD
Source
4 -- ----------------------------------------------------------------------------
1 Package Body ghr_nre_shd as
2 /* $Header: ghnrerhi.pkb 120.1.12010000.1 2009/03/26 10:13:57 utokachi noship $ */
3 --
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ghr_nre_shd.'; -- Global package name
9 --
10 --
11 -- ----------------------------------------------------------------------------
12 -- |---------------------------< constraint_error >---------------------------|
13 -- ----------------------------------------------------------------------------
14 Procedure constraint_error
15 (p_constraint_name in all_constraints.constraint_name%TYPE) Is
16 --
17 l_proc varchar2(72);
18 --
19 Begin
20 l_proc := g_package||'constraint_error';
21 hr_utility.set_location('Entering:'||l_proc, 5);
22 --
23 If (p_constraint_name = 'GHR_NOAC_REMARKS_FK1') Then
24 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
25 hr_utility.set_message_token('PROCEDURE', l_proc);
26 hr_utility.set_message_token('STEP','5');
27 hr_utility.raise_error;
28 ElsIf (p_constraint_name = 'GHR_NOAC_REMARKS_FK2') Then
29 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
30 hr_utility.set_message_token('PROCEDURE', l_proc);
31 hr_utility.set_message_token('STEP','10');
32 hr_utility.raise_error;
33 ElsIf (p_constraint_name = 'GHR_NOAC_REMARKS_PK') Then
34 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
35 hr_utility.set_message_token('PROCEDURE', l_proc);
36 hr_utility.set_message_token('STEP','15');
37 hr_utility.raise_error;
38 Else
39 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
40 hr_utility.set_message_token('PROCEDURE', l_proc);
41 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
42 hr_utility.raise_error;
43 End If;
44 --
45 hr_utility.set_location(' Leaving:'||l_proc, 10);
46 End constraint_error;
47 --
48 -- ----------------------------------------------------------------------------
49 -- |-----------------------------< api_updating >-----------------------------|
50 -- ----------------------------------------------------------------------------
51 Function api_updating
52 (
53 p_noac_remark_id in number,
54 p_object_version_number in number
55 ) Return Boolean Is
56 --
57 --
58 -- Cursor selects the 'current' row from the HR Schema
59 --
60 Cursor C_Sel1 is
61 select
62 noac_remark_id,
63 nature_of_action_id,
64 remark_id,
65 required_flag,
66 enabled_flag,
67 date_from,
68 date_to,
69 object_version_number
70 from ghr_noac_remarks
71 where noac_remark_id = p_noac_remark_id;
72 --
73 l_proc varchar2(72);
74 l_fct_ret boolean;
75 --
76 Begin
77 l_proc := g_package||'api_updating';
78 hr_utility.set_location('Entering:'||l_proc, 5);
79 --
80 If (
81 p_noac_remark_id is null and
82 p_object_version_number is null
83 ) Then
84 --
85 -- One of the primary key arguments is null therefore we must
86 -- set the returning function value to false
87 --
88 l_fct_ret := false;
89 Else
90 If (
91 p_noac_remark_id = g_old_rec.noac_remark_id and
92 p_object_version_number = g_old_rec.object_version_number
93 ) Then
94 hr_utility.set_location(l_proc, 10);
95 --
96 -- The g_old_rec is current therefore we must
97 -- set the returning function to true
98 --
99 l_fct_ret := true;
100 Else
101 --
102 -- Select the current row into g_old_rec
103 --
104 Open C_Sel1;
105 Fetch C_Sel1 Into g_old_rec;
106 If C_Sel1%notfound Then
107 Close C_Sel1;
108 --
109 -- The primary key is invalid therefore we must error
110 --
111 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
112 hr_utility.raise_error;
113 End If;
114 Close C_Sel1;
115 If (p_object_version_number <> g_old_rec.object_version_number) Then
116 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
117 hr_utility.raise_error;
118 End If;
119 hr_utility.set_location(l_proc, 15);
120 l_fct_ret := true;
121 End If;
122 End If;
123 hr_utility.set_location(' Leaving:'||l_proc, 20);
124 Return (l_fct_ret);
125 --
126 End api_updating;
127 --
128 -- ----------------------------------------------------------------------------
129 -- |---------------------------------< lck >----------------------------------|
130 -- ----------------------------------------------------------------------------
131 Procedure lck
132 (
133 p_noac_remark_id in number,
134 p_object_version_number in number
135 ) is
136 --
137 -- Cursor selects the 'current' row from the HR Schema
138 --
139 Cursor C_Sel1 is
140 select noac_remark_id,
141 nature_of_action_id,
142 remark_id,
143 required_flag,
144 enabled_flag,
145 date_from,
149 where noac_remark_id = p_noac_remark_id
146 date_to,
147 object_version_number
148 from ghr_noac_remarks
150 for update nowait;
151 --
152 l_proc varchar2(72);
153 --
154 Begin
155 l_proc := g_package||'lck';
156 hr_utility.set_location('Entering:'||l_proc, 5);
157 --
158 -- Add any mandatory argument checking here:
159 -- Example:
160 -- hr_api.mandatory_arg_error
161 -- (p_api_name => l_proc,
162 -- p_argument => 'object_version_number',
163 -- p_argument_value => p_object_version_number);
164 --
165 Open C_Sel1;
166 Fetch C_Sel1 Into g_old_rec;
167 If C_Sel1%notfound then
168 Close C_Sel1;
169 --
170 -- The primary key is invalid therefore we must error
171 --
172 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
173 hr_utility.raise_error;
174 End If;
175 Close C_Sel1;
176 If (p_object_version_number <> g_old_rec.object_version_number) Then
177 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
178 hr_utility.raise_error;
179 End If;
180 --
181 hr_utility.set_location(' Leaving:'||l_proc, 10);
182 --
183 -- We need to trap the ORA LOCK exception
184 --
185 Exception
186 When HR_Api.Object_Locked then
187 --
188 -- The object is locked therefore we need to supply a meaningful
189 -- error message.
190 --
191 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
192 hr_utility.set_message_token('TABLE_NAME', 'ghr_noac_remarks');
193 hr_utility.raise_error;
194 End lck;
195 --
196 -- ----------------------------------------------------------------------------
197 -- |-----------------------------< convert_args >-----------------------------|
198 -- ----------------------------------------------------------------------------
199 Function convert_args
200 (
201 p_noac_remark_id in number,
202 p_nature_of_action_id in number,
203 p_remark_id in number,
204 p_required_flag in varchar2,
205 p_enabled_flag in varchar2,
206 p_date_from in date,
207 p_date_to in date,
208 p_object_version_number in number
209 )
210 Return g_rec_type is
211 --
212 l_rec g_rec_type;
213 l_proc varchar2(72);
214 --
215 Begin
216 --
217 l_proc := g_package||'convert_args';
218 hr_utility.set_location('Entering:'||l_proc, 5);
219 --
220 -- Convert arguments into local l_rec structure.
221 --
222 l_rec.noac_remark_id := p_noac_remark_id;
223 l_rec.nature_of_action_id := p_nature_of_action_id;
224 l_rec.remark_id := p_remark_id;
225 l_rec.required_flag := p_required_flag;
226 l_rec.enabled_flag := p_enabled_flag;
227 l_rec.date_from := p_date_from;
228 l_rec.date_to := p_date_to;
229 l_rec.object_version_number := p_object_version_number;
230 --
231 -- Return the plsql record structure.
232 --
233 hr_utility.set_location(' Leaving:'||l_proc, 10);
234 Return(l_rec);
235 --
236 End convert_args;
237 --
238 end ghr_nre_shd;