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