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