[Home] [Help]
PACKAGE BODY: APPS.PQH_FYN_SHD
Source
1 Package Body pqh_fyn_shd as
2 /* $Header: pqfynrhi.pkb 115.6 2002/12/06 18:06:27 rpasapul ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_fyn_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_FYI_NOTIFY_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_fyi_notified_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 fyi_notified_id,
51 transaction_category_id,
52 transaction_id,
53 notification_event_cd,
54 notified_type_cd,
55 notified_name,
56 notification_date,
57 status,
58 object_version_number
59 from pqh_fyi_notify
60 where fyi_notified_id = p_fyi_notified_id;
61 --
62 l_proc varchar2(72) := g_package||'api_updating';
63 l_fct_ret boolean;
64 --
65 Begin
66 hr_utility.set_location('Entering:'||l_proc, 5);
67 --
68 If (
69 p_fyi_notified_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 (
79 p_fyi_notified_id = g_old_rec.fyi_notified_id and
80 p_object_version_number = g_old_rec.object_version_number
81 ) Then
82 hr_utility.set_location(l_proc, 10);
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 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 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
100 hr_utility.raise_error;
101 End If;
102 Close C_Sel1;
103 If (p_object_version_number <> g_old_rec.object_version_number) Then
104 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
105 hr_utility.raise_error;
106 End If;
107 hr_utility.set_location(l_proc, 15);
108 l_fct_ret := true;
109 End If;
110 End If;
111 hr_utility.set_location(' Leaving:'||l_proc, 20);
112 Return (l_fct_ret);
113 --
114 End api_updating;
115 --
116 -- ----------------------------------------------------------------------------
117 -- |---------------------------------< lck >----------------------------------|
118 -- ----------------------------------------------------------------------------
119 Procedure lck
120 (
121 p_fyi_notified_id in number,
122 p_object_version_number in number
123 ) is
124 --
125 -- Cursor selects the 'current' row from the HR Schema
126 --
127 Cursor C_Sel1 is
128 select fyi_notified_id,
129 transaction_category_id,
130 transaction_id,
131 notification_event_cd,
132 notified_type_cd,
133 notified_name,
134 notification_date,
135 status,
136 object_version_number
137 from pqh_fyi_notify
138 where fyi_notified_id = p_fyi_notified_id
139 for update nowait;
140 --
141 l_proc varchar2(72) := g_package||'lck';
142 --
143 Begin
144 hr_utility.set_location('Entering:'||l_proc, 5);
145 --
146 -- Add any mandatory argument checking here:
147 -- Example:
148 -- hr_api.mandatory_arg_error
149 -- (p_api_name => l_proc,
150 -- p_argument => 'object_version_number',
151 -- p_argument_value => p_object_version_number);
152 --
153 Open C_Sel1;
154 Fetch C_Sel1 Into g_old_rec;
155 If C_Sel1%notfound then
156 Close C_Sel1;
157 --
158 -- The primary key is invalid therefore we must error
159 --
160 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
161 hr_utility.raise_error;
162 End If;
163 Close C_Sel1;
164 If (p_object_version_number <> g_old_rec.object_version_number) Then
165 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
166 hr_utility.raise_error;
167 End If;
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(801, 'HR_7165_OBJECT_LOCKED');
180 hr_utility.set_message_token('TABLE_NAME', 'pqh_fyi_notify');
181 hr_utility.raise_error;
182 End lck;
183 --
184 -- ----------------------------------------------------------------------------
185 -- |-----------------------------< convert_args >-----------------------------|
186 -- ----------------------------------------------------------------------------
187 Function convert_args
188 (
189 p_fyi_notified_id in number,
190 p_transaction_category_id in number,
191 p_transaction_id in number,
192 p_notification_event_cd in varchar2,
193 p_notified_type_cd in varchar2,
194 p_notified_name in varchar2,
195 p_notification_date in date,
196 p_status in varchar2,
197 p_object_version_number in number
198 )
199 Return g_rec_type is
200 --
201 l_rec g_rec_type;
202 l_proc varchar2(72) := g_package||'convert_args';
203 --
204 Begin
205 --
206 hr_utility.set_location('Entering:'||l_proc, 5);
207 --
208 -- Convert arguments into local l_rec structure.
209 --
210 l_rec.fyi_notified_id := p_fyi_notified_id;
211 l_rec.transaction_category_id := p_transaction_category_id;
212 l_rec.transaction_id := p_transaction_id;
213 l_rec.notification_event_cd := p_notification_event_cd;
214 l_rec.notified_type_cd := p_notified_type_cd;
215 l_rec.notified_name := p_notified_name;
216 l_rec.notification_date := p_notification_date;
217 l_rec.status := p_status;
218 l_rec.object_version_number := p_object_version_number;
219 --
220 -- Return the plsql record structure.
221 --
222 hr_utility.set_location(' Leaving:'||l_proc, 10);
223 Return(l_rec);
224 --
225 End convert_args;
226 --
227 end pqh_fyn_shd;