[Home] [Help]
PACKAGE BODY: APPS.HR_AVM_SHD
Source
1 Package Body hr_avm_shd as
2 /* $Header: hravmrhi.pkb 115.1 2002/12/02 15:47:59 apholt noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_avm_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14 (p_constraint_name in all_constraints.constraint_name%TYPE
15 ) Is
16 --
17 l_proc varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20 --
21 If (p_constraint_name = 'HR_ATH_VARIABLEMAP_PK') Then
22 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
23 fnd_message.set_token('PROCEDURE', l_proc);
24 fnd_message.set_token('STEP','5');
25 fnd_message.raise_error;
26 Else
27 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
28 fnd_message.set_token('PROCEDURE', l_proc);
29 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
30 fnd_message.raise_error;
31 End If;
32 --
33 End constraint_error;
34 --
35 -- ----------------------------------------------------------------------------
36 -- |-----------------------------< api_updating >-----------------------------|
37 -- ----------------------------------------------------------------------------
38 Function api_updating
39 (p_ath_variablemap_id in number
40 ,p_object_version_number in number
41 )
42 Return Boolean Is
43 --
44 --
45 -- Cursor selects the 'current' row from the HR Schema
46 --
47 Cursor C_Sel1 is
48 select
49 ath_dsn
50 ,ath_tablename
51 ,ath_columnname
52 ,ath_varname
53 ,object_version_number
54 ,ath_variablemap_id
55 from hr_ath_variablemap
56 where ath_variablemap_id = p_ath_variablemap_id;
57 --
58 l_fct_ret boolean;
59 --
60 Begin
61 --
62 If (p_ath_variablemap_id is null and
63 p_object_version_number is null
64 ) Then
65 --
66 -- One of the primary key arguments is null therefore we must
67 -- set the returning function value to false
68 --
69 l_fct_ret := false;
70 Else
71 If (p_object_version_number
72 = hr_avm_shd.g_old_rec.object_version_number and
73 p_ath_variablemap_id
74 = hr_avm_shd.g_old_rec.ath_variablemap_id
75 ) Then
76 --
77 -- The g_old_rec is current therefore we must
78 -- set the returning function to true
79 --
80 l_fct_ret := true;
81 Else
82 --
83 -- Select the current row into g_old_rec
84 --
85 Open C_Sel1;
86 Fetch C_Sel1 Into hr_avm_shd.g_old_rec;
87 If C_Sel1%notfound Then
88 Close C_Sel1;
89 --
90 -- The primary key is invalid therefore we must error
91 --
92 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
93 fnd_message.raise_error;
94 End If;
95 Close C_Sel1;
96 If (p_object_version_number
97 <> hr_avm_shd.g_old_rec.object_version_number) Then
98 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
99 fnd_message.raise_error;
100 End If;
101 l_fct_ret := true;
102 End If;
103 End If;
104 Return (l_fct_ret);
105 --
106 End api_updating;
107 --
108 -- ----------------------------------------------------------------------------
109 -- |---------------------------------< lck >----------------------------------|
110 -- ----------------------------------------------------------------------------
111 Procedure lck
112 (p_ath_variablemap_id in number
113 ,p_object_version_number in number
114 ) is
115 --
116 -- Cursor selects the 'current' row from the HR Schema
117 --
118 Cursor C_Sel1 is
119 select
120 ath_variablemap_id
121 ,ath_dsn
122 ,ath_tablename
123 ,ath_columnname
124 ,ath_varname
125 ,object_version_number
126
127 from hr_ath_variablemap
128 where ath_variablemap_id = p_ath_variablemap_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 hr_api.mandatory_arg_error
137 (p_api_name => l_proc
138 ,p_argument => 'ATH_VARIABLEMAP_ID'
139 ,p_argument_value => p_ath_variablemap_id
140 );
141 hr_utility.set_location(l_proc,6);
142 hr_api.mandatory_arg_error
143 (p_api_name => l_proc
144 ,p_argument => 'OBJECT_VERSION_NUMBER'
145 ,p_argument_value => p_object_version_number
146 );
147 hr_utility.set_location(l_proc,7);
148 --
149 Open C_Sel1;
150 Fetch C_Sel1 Into hr_avm_shd.g_old_rec;
151 If C_Sel1%notfound then
152 Close C_Sel1;
153 --
154 -- The primary key is invalid therefore we must error
155 --
156 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
157 fnd_message.raise_error;
158 End If;
159 Close C_Sel1;
160 If (p_object_version_number
161 <> hr_avm_shd.g_old_rec.object_version_number) Then
162 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
163 fnd_message.raise_error;
164 End If;
165 --
166 hr_utility.set_location(' Leaving:'||l_proc, 10);
167 --
168 -- We need to trap the ORA LOCK exception
169 --
170 Exception
171 When HR_Api.Object_Locked then
172 --
173 -- The object is locked therefore we need to supply a meaningful
174 -- error message.
175 --
176 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
177 fnd_message.set_token('TABLE_NAME', 'hr_ath_variablemap');
178 fnd_message.raise_error;
179 End lck;
180 --
181 -- ----------------------------------------------------------------------------
182 -- |-----------------------------< convert_args >-----------------------------|
183 -- ----------------------------------------------------------------------------
184 Function convert_args
185 (p_ath_variablemap_id in number
186 ,p_ath_dsn in varchar2
187 ,p_ath_tablename in varchar2
188 ,p_ath_columnname in varchar2
189 ,p_ath_varname in varchar2
190 ,p_object_version_number in number
191 )
192 Return g_rec_type is
193 --
194 l_rec g_rec_type;
195 --
196 Begin
197 --
198 -- Convert arguments into local l_rec structure.
199 --
200 l_rec.ath_variablemap_id := p_ath_variablemap_id;
201 l_rec.ath_dsn := p_ath_dsn;
202 l_rec.ath_tablename := p_ath_tablename;
203 l_rec.ath_columnname := p_ath_columnname;
204 l_rec.ath_varname := p_ath_varname;
205 l_rec.object_version_number := p_object_version_number;
206 --
207 -- Return the plsql record structure.
208 --
209 Return(l_rec);
210 --
211 End convert_args;
212 --
213 end hr_avm_shd;