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