[Home] [Help]
PACKAGE BODY: APPS.PQH_RLT_SHD
Source
1 Package Body pqh_rlt_shd as
2 /* $Header: pqrltrhi.pkb 115.8 2004/02/26 10:32:25 srajakum noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_rlt_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_LISTS_PK') 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 Else
27 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
28 hr_utility.set_message_token('PROCEDURE', l_proc);
29 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
30 hr_utility.raise_error;
31 End If;
32 --
33 hr_utility.set_location(' Leaving:'||l_proc, 10);
34 End constraint_error;
35 --
36 -- ----------------------------------------------------------------------------
37 -- |-----------------------------< api_updating >-----------------------------|
38 -- ----------------------------------------------------------------------------
39 Function api_updating
40 (
41 p_routing_list_id in number,
42 p_object_version_number in number
43 ) Return Boolean Is
44 --
45 --
46 -- Cursor selects the 'current' row from the HR Schema
47 --
48 Cursor C_Sel1 is
49 select
50 routing_list_id,
51 routing_list_name,
52 enable_flag,
53 object_version_number
54 from pqh_routing_lists
55 where routing_list_id = p_routing_list_id;
56 --
57 l_proc varchar2(72) := g_package||'api_updating';
58 l_fct_ret boolean;
59 --
60 Begin
61 hr_utility.set_location('Entering:'||l_proc, 5);
62 --
63 If (
64 p_routing_list_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 (
74 p_routing_list_id = g_old_rec.routing_list_id and
75 p_object_version_number = g_old_rec.object_version_number
76 ) Then
77 hr_utility.set_location(l_proc, 10);
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 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 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
95 hr_utility.raise_error;
96 End If;
97 Close C_Sel1;
98 If (p_object_version_number <> g_old_rec.object_version_number) Then
99 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
100 hr_utility.raise_error;
101 End If;
102 hr_utility.set_location(l_proc, 15);
103 l_fct_ret := true;
104 End If;
105 End If;
106 hr_utility.set_location(' Leaving:'||l_proc, 20);
107 Return (l_fct_ret);
108 --
109 End api_updating;
110 --
111 -- ----------------------------------------------------------------------------
112 -- |---------------------------------< lck >----------------------------------|
113 -- ----------------------------------------------------------------------------
114 Procedure lck
115 (
116 p_routing_list_id in number,
117 p_object_version_number in number
118 ) is
119 --
120 -- Cursor selects the 'current' row from the HR Schema
121 --
122 Cursor C_Sel1 is
123 select routing_list_id,
124 routing_list_name,
125 enable_flag,
126 object_version_number
127 from pqh_routing_lists
128 where routing_list_id = p_routing_list_id
129 for update nowait;
130 --
131 l_proc varchar2(72) := g_package||'lck';
132 --
133 Begin
134 hr_utility.set_location('Entering:'||l_proc, 5);
135 --
136 -- Add any mandatory argument checking here:
137 -- Example:
138 -- hr_api.mandatory_arg_error
139 -- (p_api_name => l_proc,
140 -- p_argument => 'object_version_number',
141 -- p_argument_value => p_object_version_number);
142 --
143 Open C_Sel1;
144 Fetch C_Sel1 Into g_old_rec;
145 If C_Sel1%notfound then
146 Close C_Sel1;
147 --
148 -- The primary key is invalid therefore we must error
149 --
150 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
151 hr_utility.raise_error;
152 End If;
153 Close C_Sel1;
154 If (p_object_version_number <> g_old_rec.object_version_number) Then
155 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
156 hr_utility.raise_error;
157 End If;
158 --
159 hr_utility.set_location(' Leaving:'||l_proc, 10);
160 --
161 -- We need to trap the ORA LOCK exception
162 --
163 Exception
164 When HR_Api.Object_Locked then
165 --
166 -- The object is locked therefore we need to supply a meaningful
167 -- error message.
168 --
169 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
170 hr_utility.set_message_token('TABLE_NAME', 'pqh_routing_lists');
171 hr_utility.raise_error;
172 End lck;
173 --
174 -- ----------------------------------------------------------------------------
175 -- |-----------------------------< convert_args >-----------------------------|
176 -- ----------------------------------------------------------------------------
177 Function convert_args
178 (
179 p_routing_list_id in number,
180 p_routing_list_name in varchar2,
181 p_enable_flag in varchar2,
182 p_object_version_number in number
183 )
184 Return g_rec_type is
185 --
186 l_rec g_rec_type;
187 l_proc varchar2(72) := g_package||'convert_args';
188 --
189 Begin
190 --
191 hr_utility.set_location('Entering:'||l_proc, 5);
192 --
193 -- Convert arguments into local l_rec structure.
194 --
195 l_rec.routing_list_id := p_routing_list_id;
196 l_rec.routing_list_name := p_routing_list_name;
197 l_rec.enable_flag := p_enable_flag;
198 l_rec.object_version_number := p_object_version_number;
199 --
200 -- Return the plsql record structure.
201 --
202 hr_utility.set_location(' Leaving:'||l_proc, 10);
203 Return(l_rec);
204 --
205 End convert_args;
206 --
207 end pqh_rlt_shd;