DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_HAT_SHD

Source


1 Package Body hxc_hat_shd as
2 /* $Header: hxchatrhi.pkb 120.2 2005/09/23 10:41:13 sechandr noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  hxc_hat_shd.';  -- Global package name
9 g_debug	boolean	:=hr_utility.debug_enabled;
10 --
11 -- ----------------------------------------------------------------------------
12 -- |---------------------------< constraint_error >---------------------------|
13 -- ----------------------------------------------------------------------------
14 Procedure constraint_error
15   (p_constraint_name in all_constraints.constraint_name%TYPE
16   ) Is
17 --
18   l_proc        varchar2(72) := g_package||'constraint_error';
19 --
20 Begin
21   --
22   If (p_constraint_name = 'HXC_ALIAS_TYPES_PK') Then
23     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
24     fnd_message.set_token('PROCEDURE', l_proc);
25     fnd_message.set_token('STEP','5');
26     fnd_message.raise_error;
27   Else
28     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
29     fnd_message.set_token('PROCEDURE', l_proc);
30     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
31     fnd_message.raise_error;
32   End If;
33   --
34 End constraint_error;
35 --
36 -- ----------------------------------------------------------------------------
37 -- |-----------------------------< api_updating >-----------------------------|
38 -- ----------------------------------------------------------------------------
39 Function api_updating
40   (p_alias_type_id                        in     number
41   ,p_object_version_number                in     number
42   )
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        alias_type_id
51       ,alias_type
52       ,reference_object
53       ,object_version_number
54     from        hxc_alias_types
55     where       alias_type_id = p_alias_type_id;
56   --
57   l_fct_ret     boolean;
58   --
59 Begin
60   --
61   If (p_alias_type_id is null and
62       p_object_version_number is null
63      ) Then
64     --
65     -- One of the primary key arguments is null therefore we must
66     -- set the returning function value to false
67     --
68     l_fct_ret := false;
69   Else
70     If (p_alias_type_id
71         = hxc_hat_shd.g_old_rec.alias_type_id and
72         p_object_version_number
73         = hxc_hat_shd.g_old_rec.object_version_number
74        ) Then
75       --
76       -- The g_old_rec is current therefore we must
77       -- set the returning function to true
78       --
79       l_fct_ret := true;
80     Else
81       --
82       -- Select the current row into g_old_rec
83       --
84       Open C_Sel1;
85       Fetch C_Sel1 Into hxc_hat_shd.g_old_rec;
86       If C_Sel1%notfound Then
87         Close C_Sel1;
88         --
89         -- The primary key is invalid therefore we must error
90         --
91         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
92         fnd_message.raise_error;
93       End If;
94       Close C_Sel1;
95       If (p_object_version_number
96           <> hxc_hat_shd.g_old_rec.object_version_number) Then
97         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
98         fnd_message.raise_error;
99       End If;
100       l_fct_ret := true;
101     End If;
102   End If;
103   Return (l_fct_ret);
104 --
105 End api_updating;
106 --
107 -- ----------------------------------------------------------------------------
108 -- |---------------------------------< lck >----------------------------------|
109 -- ----------------------------------------------------------------------------
110 Procedure lck
111   (p_alias_type_id                        in     number
112   ,p_object_version_number                in     number
113   ) is
114 --
115 -- Cursor selects the 'current' row from the HR Schema
116 --
117   Cursor C_Sel1 is
118     select
119        alias_type_id
120       ,alias_type
121       ,reference_object
122       ,object_version_number
123     from        hxc_alias_types
124     where       alias_type_id = p_alias_type_id
125     for update nowait;
126 --
127   l_proc        varchar2(72);
128 --
129 Begin
130   g_debug:=hr_utility.debug_enabled;
131   if g_debug then
132 	l_proc := g_package||'lck';
133 	hr_utility.set_location('Entering:'||l_proc, 5);
134   end if;
135   --
136   hr_api.mandatory_arg_error
137     (p_api_name           => l_proc
138     ,p_argument           => 'ALIAS_TYPE_ID'
139     ,p_argument_value     => p_alias_type_id
140     );
141   if g_debug then
142 	hr_utility.set_location(l_proc,6);
143   end if;
144   hr_api.mandatory_arg_error
145     (p_api_name           => l_proc
146     ,p_argument           => 'OBJECT_VERSION_NUMBER'
147     ,p_argument_value     => p_object_version_number
148     );
149   --
150   Open  C_Sel1;
151   Fetch C_Sel1 Into hxc_hat_shd.g_old_rec;
152   If C_Sel1%notfound then
153     Close C_Sel1;
154     --
155     -- The primary key is invalid therefore we must error
156     --
157     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
158     fnd_message.raise_error;
159   End If;
160   Close C_Sel1;
161   If (p_object_version_number
162       <> hxc_hat_shd.g_old_rec.object_version_number) Then
163         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
164         fnd_message.raise_error;
165   End If;
166   --
167   if g_debug then
168 	hr_utility.set_location(' Leaving:'||l_proc, 10);
169   end if;
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     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
180     fnd_message.set_token('TABLE_NAME', 'hxc_alias_types');
181     fnd_message.raise_error;
182 End lck;
183 --
184 -- ----------------------------------------------------------------------------
185 -- |-----------------------------< convert_args >-----------------------------|
186 -- ----------------------------------------------------------------------------
187 Function convert_args
188   (p_alias_type_id                  in number
189   ,p_alias_type                     in varchar2
190   ,p_reference_object               in varchar2
191   ,p_object_version_number          in number
192   )
193   Return g_rec_type is
194 --
195   l_rec   g_rec_type;
196 --
197 Begin
198   --
199   -- Convert arguments into local l_rec structure.
200   --
201   l_rec.alias_type_id                    := p_alias_type_id;
202   l_rec.alias_type                       := p_alias_type;
203   l_rec.reference_object                 := p_reference_object;
204   l_rec.object_version_number            := p_object_version_number;
205   --
206   -- Return the plsql record structure.
207   --
208   Return(l_rec);
209 --
210 End convert_args;
211 --
212 end hxc_hat_shd;