[Home] [Help]
PACKAGE BODY: APPS.PQH_VLE_SHD
Source
1 Package Body pqh_vle_shd as
2 /* $Header: pqvlerhi.pkb 115.2 2002/12/13 00:35:03 rpasapul noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_vle_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 = 'PQH_VLE_FK') Then
22 fnd_message.set_name('PAY', '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 ElsIf (p_constraint_name = 'PQH_VLE_PK') Then
27 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
28 fnd_message.set_token('PROCEDURE', l_proc);
29 fnd_message.set_token('STEP','10');
30 fnd_message.raise_error;
31 Else
32 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
33 fnd_message.set_token('PROCEDURE', l_proc);
34 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
35 fnd_message.raise_error;
36 End If;
37 --
38 End constraint_error;
39 --
40 -- ----------------------------------------------------------------------------
41 -- |-----------------------------< api_updating >-----------------------------|
42 -- ----------------------------------------------------------------------------
43 Function api_updating
44 (p_validation_event_id in number
45 ,p_object_version_number in number
46 )
47 Return Boolean Is
48 --
49 --
50 -- Cursor selects the 'current' row from the HR Schema
51 --
52 Cursor C_Sel1 is
53 select
54 validation_event_id
55 ,validation_id
56 ,event_type
57 ,event_code
58 ,start_date
59 ,end_date
60 ,comments
61 ,object_version_number
62 from pqh_fr_validation_events
63 where validation_event_id = p_validation_event_id;
64 --
65 l_fct_ret boolean;
66 --
67 Begin
68 --
69 If (p_validation_event_id is null and
70 p_object_version_number is null
71 ) Then
72 --
73 -- One of the primary key arguments is null therefore we must
74 -- set the returning function value to false
75 --
76 l_fct_ret := false;
77 Else
78 If (p_validation_event_id
79 = pqh_vle_shd.g_old_rec.validation_event_id and
80 p_object_version_number
81 = pqh_vle_shd.g_old_rec.object_version_number
82 ) Then
83 --
84 -- The g_old_rec is current therefore we must
85 -- set the returning function to true
86 --
87 l_fct_ret := true;
88 Else
89 --
90 -- Select the current row into g_old_rec
91 --
92 Open C_Sel1;
93 Fetch C_Sel1 Into pqh_vle_shd.g_old_rec;
94 If C_Sel1%notfound Then
95 Close C_Sel1;
96 --
97 -- The primary key is invalid therefore we must error
98 --
99 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
100 fnd_message.raise_error;
101 End If;
102 Close C_Sel1;
103 If (p_object_version_number
104 <> pqh_vle_shd.g_old_rec.object_version_number) Then
105 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
106 fnd_message.raise_error;
107 End If;
108 l_fct_ret := true;
109 End If;
110 End If;
111 Return (l_fct_ret);
112 --
113 End api_updating;
114 --
115 -- ----------------------------------------------------------------------------
116 -- |---------------------------------< lck >----------------------------------|
117 -- ----------------------------------------------------------------------------
118 Procedure lck
119 (p_validation_event_id in number
120 ,p_object_version_number in number
121 ) is
122 --
123 -- Cursor selects the 'current' row from the HR Schema
124 --
125 Cursor C_Sel1 is
126 select
127 validation_event_id
128 ,validation_id
129 ,event_type
130 ,event_code
131 ,start_date
132 ,end_date
133 ,comments
134 ,object_version_number
135 from pqh_fr_validation_events
136 where validation_event_id = p_validation_event_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 hr_api.mandatory_arg_error
145 (p_api_name => l_proc
146 ,p_argument => 'VALIDATION_EVENT_ID'
147 ,p_argument_value => p_validation_event_id
148 );
149 hr_utility.set_location(l_proc,6);
150 hr_api.mandatory_arg_error
151 (p_api_name => l_proc
152 ,p_argument => 'OBJECT_VERSION_NUMBER'
153 ,p_argument_value => p_object_version_number
154 );
155 --
156 Open C_Sel1;
157 Fetch C_Sel1 Into pqh_vle_shd.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 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
164 fnd_message.raise_error;
165 End If;
166 Close C_Sel1;
167 If (p_object_version_number
168 <> pqh_vle_shd.g_old_rec.object_version_number) Then
169 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
170 fnd_message.raise_error;
171 End If;
172 --
173 hr_utility.set_location(' Leaving:'||l_proc, 10);
174 --
175 -- We need to trap the ORA LOCK exception
176 --
177 Exception
178 When HR_Api.Object_Locked then
179 --
180 -- The object is locked therefore we need to supply a meaningful
181 -- error message.
182 --
183 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
184 fnd_message.set_token('TABLE_NAME', 'pqh_fr_validation_events');
185 fnd_message.raise_error;
186 End lck;
187 --
188 -- ----------------------------------------------------------------------------
189 -- |-----------------------------< convert_args >-----------------------------|
190 -- ----------------------------------------------------------------------------
191 Function convert_args
192 (p_validation_event_id in number
193 ,p_validation_id in number
194 ,p_event_type in varchar2
195 ,p_event_code in varchar2
196 ,p_start_date in date
197 ,p_end_date in date
198 ,p_comments in varchar2
199 ,p_object_version_number in number
200 )
201 Return g_rec_type is
202 --
203 l_rec g_rec_type;
204 --
205 Begin
206 --
207 -- Convert arguments into local l_rec structure.
208 --
209 l_rec.validation_event_id := p_validation_event_id;
210 l_rec.validation_id := p_validation_id;
211 l_rec.event_type := p_event_type;
212 l_rec.event_code := p_event_code;
213 l_rec.start_date := p_start_date;
214 l_rec.end_date := p_end_date;
215 l_rec.comments := p_comments;
216 l_rec.object_version_number := p_object_version_number;
217 --
218 -- Return the plsql record structure.
219 --
220 Return(l_rec);
221 --
222 End convert_args;
223 --
224 end pqh_vle_shd;