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