DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_TKGQC_SHD

Source


1 Package Body hxc_tkgqc_shd as
2 /* $Header: hxctkgqcrhi.pkb 120.2 2005/09/23 05:26:07 rchennur noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  hxc_tkgqc_shd.';  -- Global package name
9 
10 g_debug boolean := hr_utility.debug_enabled;
11 --
12 -- ----------------------------------------------------------------------------
13 -- |------------------------< return_api_dml_status >-------------------------|
14 -- ----------------------------------------------------------------------------
15 Function return_api_dml_status Return Boolean Is
16 --
17 Begin
18   --
19   Return (nvl(g_api_dml, false));
20   --
21 End return_api_dml_status;
22 --
23 -- ----------------------------------------------------------------------------
24 -- |---------------------------< constraint_error >---------------------------|
25 -- ----------------------------------------------------------------------------
26 Procedure constraint_error
27   (p_constraint_name in all_constraints.constraint_name%TYPE
28   ) Is
29 --
30   l_proc        varchar2(72) := g_package||'constraint_error';
31 --
32 Begin
33   --
34 
35 
36   If (p_constraint_name = 'HXC_TK_GROUP_QUERY_CRITERIA_PK') Then
37     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
38     fnd_message.set_token('PROCEDURE', l_proc);
39     fnd_message.set_token('STEP','5');
40     fnd_message.raise_error;
41   Else
42     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
43     fnd_message.set_token('PROCEDURE', l_proc);
44     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
45     fnd_message.raise_error;
46   End If;
47   --
48 End constraint_error;
49 --
50 -- ----------------------------------------------------------------------------
51 -- |-----------------------------< api_updating >-----------------------------|
52 -- ----------------------------------------------------------------------------
53 Function api_updating
54   (p_tk_group_query_criteria_id           in     number
55   ,p_object_version_number                in     number
56   )
57   Return Boolean Is
58   --
59   --
60   -- Cursor selects the 'current' row from the HR Schema
61   --
62   Cursor C_Sel1 is
63     select
64        tk_group_query_criteria_id
65       ,tk_group_query_id
66       ,criteria_type
67       ,criteria_id
68       ,object_version_number
69     from        hxc_tk_group_query_criteria
70     where       tk_group_query_criteria_id = p_tk_group_query_criteria_id;
71   --
72   l_fct_ret     boolean;
73   --
74 Begin
75 
76   --
77   If (p_tk_group_query_criteria_id is null and
78       p_object_version_number is null
79      ) Then
80     --
81     -- One of the primary key arguments is null therefore we must
82     -- set the returning function value to false
83     --
84     l_fct_ret := false;
85   Else
86     If (p_tk_group_query_criteria_id
87         = hxc_tkgqc_shd.g_old_rec.tk_group_query_criteria_id and
88         p_object_version_number
89         = hxc_tkgqc_shd.g_old_rec.object_version_number
90        ) Then
91       --
92       -- The g_old_rec is current therefore we must
93       -- set the returning function to true
94       --
95       l_fct_ret := true;
96     Else
97       --
98       -- Select the current row into g_old_rec
99       --
100       Open C_Sel1;
101       Fetch C_Sel1 Into hxc_tkgqc_shd.g_old_rec;
102       If C_Sel1%notfound Then
103         Close C_Sel1;
104         --
105         -- The primary key is invalid therefore we must error
106         --
107         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
108         fnd_message.raise_error;
109       End If;
110       Close C_Sel1;
111       If (p_object_version_number
112           <> hxc_tkgqc_shd.g_old_rec.object_version_number) Then
113         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
114         fnd_message.raise_error;
115       End If;
116       l_fct_ret := true;
117     End If;
118   End If;
119   Return (l_fct_ret);
120 --
121 End api_updating;
122 --
123 -- ----------------------------------------------------------------------------
124 -- |---------------------------------< lck >----------------------------------|
125 -- ----------------------------------------------------------------------------
126 Procedure lck
127   (p_tk_group_query_criteria_id           in     number
128   ,p_object_version_number                in     number
129   ) is
130 --
131 -- Cursor selects the 'current' row from the HR Schema
132 --
133   Cursor C_Sel1 is
134     select
135        tk_group_query_criteria_id
136       ,tk_group_query_id
137       ,criteria_type
138       ,criteria_id
139       ,object_version_number
140     from        hxc_tk_group_query_criteria
141     where       tk_group_query_criteria_id = p_tk_group_query_criteria_id
142     for update nowait;
143 --
144   l_proc        varchar2(72) ;
145 --
146 Begin
147   g_debug :=hr_utility.debug_enabled;
148   if g_debug then
149 	l_proc := g_package||'lck';
150 
151 	hr_utility.set_location('Entering:'||l_proc, 5);
152   end if;
153   --
154   hr_api.mandatory_arg_error
155     (p_api_name           => l_proc
156     ,p_argument           => 'TK_GROUP_QUERY_CRITERIA_ID'
157     ,p_argument_value     => p_tk_group_query_criteria_id
158     );
159   if g_debug then
160 	hr_utility.set_location(l_proc,6);
161   end if;
162   hr_api.mandatory_arg_error
163     (p_api_name           => l_proc
164     ,p_argument           => 'OBJECT_VERSION_NUMBER'
165     ,p_argument_value     => p_object_version_number
166     );
167   --
168   Open  C_Sel1;
169   Fetch C_Sel1 Into hxc_tkgqc_shd.g_old_rec;
170   If C_Sel1%notfound then
171     Close C_Sel1;
172     --
173     -- The primary key is invalid therefore we must error
174     --
175     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
176     fnd_message.raise_error;
177   End If;
178   Close C_Sel1;
179   If (p_object_version_number
180       <> hxc_tkgqc_shd.g_old_rec.object_version_number) Then
181         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
182         fnd_message.raise_error;
183   End If;
184   --
185   if g_debug then
186 	hr_utility.set_location(' Leaving:'||l_proc, 10);
187   end if;
188   --
189   -- We need to trap the ORA LOCK exception
190   --
191 Exception
192   When HR_Api.Object_Locked then
193     --
194     -- The object is locked therefore we need to supply a meaningful
195     -- error message.
196     --
197     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
198     fnd_message.set_token('TABLE_NAME', 'hxc_tk_group_query_criteria');
199     fnd_message.raise_error;
200 End lck;
201 --
202 -- ----------------------------------------------------------------------------
203 -- |-----------------------------< convert_args >-----------------------------|
204 -- ----------------------------------------------------------------------------
205 Function convert_args
206   (p_tk_group_query_criteria_id     in number
207   ,p_tk_group_query_id              in number
208   ,p_criteria_type                  in varchar2
209   ,p_criteria_id                    in number
210   ,p_object_version_number          in number
211   )
212   Return g_rec_type is
213 --
214   l_rec   g_rec_type;
215 --
216 Begin
217   --
218   -- Convert arguments into local l_rec structure.
219   --
220   l_rec.tk_group_query_criteria_id       := p_tk_group_query_criteria_id;
221   l_rec.tk_group_query_id                := p_tk_group_query_id;
222   l_rec.criteria_type                    := p_criteria_type;
223   l_rec.criteria_id                      := p_criteria_id;
224   l_rec.object_version_number            := p_object_version_number;
225   --
226   -- Return the plsql record structure.
227   --
228   Return(l_rec);
229 --
230 End convert_args;
231 --
232 end hxc_tkgqc_shd;