[Home] [Help]
PACKAGE BODY: APPS.PQH_TTM_SHD
Source
1 Package Body pqh_ttm_shd as
2 /* $Header: pqttmrhi.pkb 115.4 2002/12/12 21:26:03 rpasapul noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_ttm_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_TRANSACTION_TEMPLATE_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_TRANSACTION_TEMPLATE_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_TRANSACTION_TEMPLATE_PK') 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','15');
35 hr_utility.raise_error;
36 ElsIf (p_constraint_name = 'PQH_TRANSACTION_TEMPLATE_UK') 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','20');
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_transaction_template_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 transaction_template_id,
66 enable_flag,
67 template_id,
68 transaction_id,
69 transaction_category_id,
70 object_version_number
71 from pqh_transaction_templates
72 where transaction_template_id = p_transaction_template_id;
73 --
74 l_proc varchar2(72) := g_package||'api_updating';
75 l_fct_ret boolean;
76 --
77 Begin
78 hr_utility.set_location('Entering:'||l_proc, 5);
79 --
80 If (
81 p_transaction_template_id is null and
82 p_object_version_number is null
83 ) Then
84 --
85 -- One of the primary key arguments is null therefore we must
86 -- set the returning function value to false
87 --
88 l_fct_ret := false;
89 Else
90 If (
91 p_transaction_template_id = g_old_rec.transaction_template_id and
92 p_object_version_number = g_old_rec.object_version_number
93 ) Then
94 hr_utility.set_location(l_proc, 10);
95 --
96 -- The g_old_rec is current therefore we must
97 -- set the returning function to true
98 --
99 l_fct_ret := true;
100 Else
101 --
102 -- Select the current row into g_old_rec
103 --
104 Open C_Sel1;
105 Fetch C_Sel1 Into g_old_rec;
106 If C_Sel1%notfound Then
107 Close C_Sel1;
108 --
109 -- The primary key is invalid therefore we must error
110 --
111 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
112 hr_utility.raise_error;
113 End If;
114 Close C_Sel1;
115 If (p_object_version_number <> g_old_rec.object_version_number) Then
116 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
117 hr_utility.raise_error;
118 End If;
119 hr_utility.set_location(l_proc, 15);
120 l_fct_ret := true;
121 End If;
122 End If;
123 hr_utility.set_location(' Leaving:'||l_proc, 20);
124 Return (l_fct_ret);
125 --
126 End api_updating;
127 --
128 -- ----------------------------------------------------------------------------
129 -- |---------------------------------< lck >----------------------------------|
130 -- ----------------------------------------------------------------------------
131 Procedure lck
132 (
133 p_transaction_template_id in number,
134 p_object_version_number in number
135 ) is
136 --
137 -- Cursor selects the 'current' row from the HR Schema
138 --
139 Cursor C_Sel1 is
140 select transaction_template_id,
141 enable_flag,
142 template_id,
143 transaction_id,
144 transaction_category_id,
145 object_version_number
146 from pqh_transaction_templates
147 where transaction_template_id = p_transaction_template_id
148 for update nowait;
149 --
150 l_proc varchar2(72) := g_package||'lck';
151 --
152 Begin
153 hr_utility.set_location('Entering:'||l_proc, 5);
154 --
155 -- Add any mandatory argument checking here:
156 -- Example:
157 -- hr_api.mandatory_arg_error
158 -- (p_api_name => l_proc,
159 -- p_argument => 'object_version_number',
160 -- p_argument_value => p_object_version_number);
161 --
162 Open C_Sel1;
163 Fetch C_Sel1 Into g_old_rec;
164 If C_Sel1%notfound then
165 Close C_Sel1;
166 --
167 -- The primary key is invalid therefore we must error
168 --
169 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
170 hr_utility.raise_error;
171 End If;
172 Close C_Sel1;
173 If (p_object_version_number <> g_old_rec.object_version_number) Then
174 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
175 hr_utility.raise_error;
176 End If;
177 --
178 hr_utility.set_location(' Leaving:'||l_proc, 10);
179 --
180 -- We need to trap the ORA LOCK exception
181 --
182 Exception
183 When HR_Api.Object_Locked then
184 --
185 -- The object is locked therefore we need to supply a meaningful
186 -- error message.
187 --
188 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
189 hr_utility.set_message_token('TABLE_NAME', 'pqh_transaction_templates');
190 hr_utility.raise_error;
191 End lck;
192 --
193 -- ----------------------------------------------------------------------------
194 -- |-----------------------------< convert_args >-----------------------------|
195 -- ----------------------------------------------------------------------------
196 Function convert_args
197 (
198 p_transaction_template_id in number,
199 p_enable_flag in varchar2,
200 p_template_id in number,
201 p_transaction_id in number,
202 p_transaction_category_id in number,
203 p_object_version_number in number
204 )
205 Return g_rec_type is
206 --
207 l_rec g_rec_type;
208 l_proc varchar2(72) := g_package||'convert_args';
209 --
210 Begin
211 --
212 hr_utility.set_location('Entering:'||l_proc, 5);
213 --
214 -- Convert arguments into local l_rec structure.
215 --
216 l_rec.transaction_template_id := p_transaction_template_id;
217 l_rec.enable_flag := p_enable_flag;
218 l_rec.template_id := p_template_id;
219 l_rec.transaction_id := p_transaction_id;
220 l_rec.transaction_category_id := p_transaction_category_id;
221 l_rec.object_version_number := p_object_version_number;
222 --
223 -- Return the plsql record structure.
224 --
225 hr_utility.set_location(' Leaving:'||l_proc, 10);
226 Return(l_rec);
227 --
228 End convert_args;
229 --
230 end pqh_ttm_shd;