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