[Home] [Help]
PACKAGE BODY: APPS.HR_QSA_SHD
Source
1 Package Body hr_qsa_shd as
2 /* $Header: hrqsarhi.pkb 115.12 2003/08/27 00:16:05 hpandya ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_qsa_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_ANSWERS_FK1') Then
22 fnd_message.set_name('PER', 'PER_52427_QSA_QU_TMPLT_INVALID');
23 fnd_message.raise_error;
24 ElsIf (p_constraint_name = 'HR_QUEST_ANSWERS_FK2') Then
25 fnd_message.set_name('PER', 'PER_52428_QSA_INVAL_BUS_GRP');
26 fnd_message.raise_error;
27 ElsIf (p_constraint_name = 'HR_QUEST_ANSWERS_PK') Then
28 -- leave, as unlikely to occur
29 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
30 fnd_message.set_token('PROCEDURE',l_proc);
31 fnd_message.set_token('STEP','20');
32 fnd_message.raise_error;
33 ElsIf (p_constraint_name = 'HR_QUEST_ANSWERS_UK1') Then
34 fnd_message.set_name('PER', 'PER_52441_NON_UNIQUE_TYPE');
35 fnd_message.raise_error;
36 ElsIf (p_constraint_name = 'HR_QUEST_ANS_TYPE_CHK') Then
37 fnd_message.set_name('PER', 'PER_52429_QSA_INVAL_ANS_TYPE');
38 fnd_message.raise_error;
39 Else
40 hr_utility.set_message('PER', 'HR_7877_API_INVALID_CONSTRAINT');
41 hr_utility.set_message_token('PROCEDURE', l_proc);
42 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
43 hr_utility.raise_error;
44 End If;
45 --
46 hr_utility.set_location(' Leaving:'||l_proc, 10);
47 End constraint_error;
48 --
49 -- ----------------------------------------------------------------------------
50 -- |-----------------------------< api_updating >-----------------------------|
51 -- ----------------------------------------------------------------------------
52 Function api_updating
53 (
54 p_questionnaire_answer_id 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 questionnaire_answer_id,
63 questionnaire_template_id,
64 type,
65 type_object_id,
66 business_group_id
67 from hr_quest_answers
68 where questionnaire_answer_id = p_questionnaire_answer_id;
69 --
70 l_proc varchar2(72) := g_package||'api_updating';
71 l_fct_ret boolean;
72 --
73 Begin
74 hr_utility.set_location('Entering:'||l_proc, 5);
75 --
76 If (
77 p_questionnaire_answer_id is null
78 ) Then
79 --
80 -- One of the primary key arguments is null therefore we must
81 -- set the returning function value to false
82 --
83 l_fct_ret := false;
84 Else
85 If (
86 p_questionnaire_answer_id = g_old_rec.questionnaire_answer_id
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('PER', 'HR_7220_INVALID_PRIMARY_KEY');
106 hr_utility.raise_error;
107 End If;
108 Close C_Sel1;
109 --
110 hr_utility.set_location(l_proc, 15);
111 l_fct_ret := true;
112 End If;
113 End If;
114 hr_utility.set_location(' Leaving:'||l_proc, 20);
115 Return (l_fct_ret);
116 --
117 End api_updating;
118 --
119 -- ----------------------------------------------------------------------------
120 -- |---------------------------------< lck >----------------------------------|
121 -- ----------------------------------------------------------------------------
122 Procedure lck
123 (
124 p_questionnaire_answer_id in number
125 ) is
126 --
127 -- Cursor selects the 'current' row from the HR Schema
128 --
129 Cursor C_Sel1 is
130 select questionnaire_answer_id,
131 questionnaire_template_id,
132 type,
133 type_object_id,
134 business_group_id
135 from hr_quest_answers
136 where questionnaire_answer_id = p_questionnaire_answer_id
137 for update nowait;
138 --
139 l_proc varchar2(72) := g_package||'lck';
140 --
141 Begin
142 hr_utility.set_location('Entering:'||l_proc, 5);
143 --
144 -- Add any mandatory argument checking here:
145 -- Example:
146 -- hr_api.mandatory_arg_error
147 -- (p_api_name => l_proc,
148 -- p_argument => 'object_version_number',
149 -- p_argument_value => p_object_version_number);
150 --
151 hr_api.mandatory_arg_error
152 (p_api_name => l_proc
153 ,p_argument => 'questionnaire_answer_id'
154 ,p_argument_value => p_questionnaire_answer_id);
155 --
156 Open C_Sel1;
157 Fetch C_Sel1 Into g_old_rec;
158 If C_Sel1%notfound then
159 Close C_Sel1;
160 --
161 -- The primary key is invalid therefore we must error
162 --
163 hr_utility.set_message('PER', 'HR_7220_INVALID_PRIMARY_KEY');
164 hr_utility.raise_error;
165 End If;
166 Close C_Sel1;
167 --
168 --
169 hr_utility.set_location(' Leaving:'||l_proc, 10);
170 --
171 -- We need to trap the ORA LOCK exception
172 --
173 Exception
174 When HR_Api.Object_Locked then
175 --
176 -- The object is locked therefore we need to supply a meaningful
177 -- error message.
178 --
179 hr_utility.set_message('PER', 'HR_7165_OBJECT_LOCKED');
180 hr_utility.set_message_token('TABLE_NAME', 'hr_quest_answers');
181 hr_utility.raise_error;
182 End lck;
183 --
184 -- ----------------------------------------------------------------------------
185 -- |-----------------------------< convert_args >-----------------------------|
186 -- ----------------------------------------------------------------------------
187 Function convert_args
188 (
189 p_questionnaire_answer_id in number,
190 p_questionnaire_template_id in number,
191 p_type in varchar2,
192 p_type_object_id in number,
193 p_business_group_id in number
194 )
195 Return g_rec_type is
196 --
197 l_rec g_rec_type;
198 l_proc varchar2(72) := g_package||'convert_args';
199 --
200 Begin
201 --
202 hr_utility.set_location('Entering:'||l_proc, 5);
203 --
204 -- Convert arguments into local l_rec structure.
205 --
206 l_rec.questionnaire_answer_id := p_questionnaire_answer_id;
207 l_rec.questionnaire_template_id := p_questionnaire_template_id;
208 l_rec.type := p_type;
209 l_rec.type_object_id := p_type_object_id;
210 l_rec.business_group_id := p_business_group_id;
211 --
212 -- Return the plsql record structure.
213 --
214 hr_utility.set_location(' Leaving:'||l_proc, 10);
215 Return(l_rec);
216 --
217 End convert_args;
218 --
219 end hr_qsa_shd;