[Home] [Help]
PACKAGE BODY: APPS.PER_CAI_SHD
Source
1 Package Body per_cai_shd as
2 /* $Header: pecairhi.pkb 115.1 2002/12/04 05:50:07 raranjan noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_cai_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 = 'PER_CAGR_API_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_cagr_api_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 cagr_api_id
50 ,api_name
51 ,category_name
52 ,object_version_number
53 from per_cagr_apis
54 where cagr_api_id = p_cagr_api_id;
55 --
56 l_fct_ret boolean;
57 --
58 Begin
59 --
60 If (p_cagr_api_id is null and
61 p_object_version_number is null
62 ) Then
63 --
64 -- One of the primary key arguments is null therefore we must
65 -- set the returning function value to false
66 --
67 l_fct_ret := false;
68 Else
69 If (p_cagr_api_id
70 = per_cai_shd.g_old_rec.cagr_api_id and
71 p_object_version_number
72 = per_cai_shd.g_old_rec.object_version_number
73 ) Then
74 --
75 -- The g_old_rec is current therefore we must
76 -- set the returning function to true
77 --
78 l_fct_ret := true;
79 Else
80 --
81 -- Select the current row into g_old_rec
82 --
83 Open C_Sel1;
84 Fetch C_Sel1 Into per_cai_shd.g_old_rec;
85 If C_Sel1%notfound Then
86 Close C_Sel1;
87 --
88 -- The primary key is invalid therefore we must error
89 --
90 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
91 fnd_message.raise_error;
92 End If;
93 Close C_Sel1;
94 If (p_object_version_number
95 <> per_cai_shd.g_old_rec.object_version_number) Then
96 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
97 fnd_message.raise_error;
98 End If;
99 l_fct_ret := true;
100 End If;
101 End If;
102 Return (l_fct_ret);
103 --
104 End api_updating;
105 --
106 -- ----------------------------------------------------------------------------
107 -- |---------------------------------< lck >----------------------------------|
108 -- ----------------------------------------------------------------------------
109 Procedure lck
110 (p_cagr_api_id in number
111 ,p_object_version_number in number
112 ) is
113 --
114 -- Cursor selects the 'current' row from the HR Schema
115 --
116 Cursor C_Sel1 is
117 select
118 cagr_api_id
119 ,api_name
120 ,category_name
121 ,object_version_number
122 from per_cagr_apis
123 where cagr_api_id = p_cagr_api_id
124 for update nowait;
125 --
126 l_proc varchar2(72) := g_package||'lck';
127 --
128 Begin
129 hr_utility.set_location('Entering:'||l_proc, 5);
130 --
131 hr_api.mandatory_arg_error
132 (p_api_name => l_proc
133 ,p_argument => 'CAGR_API_ID'
134 ,p_argument_value => p_cagr_api_id
135 );
136 --
137 Open C_Sel1;
138 Fetch C_Sel1 Into per_cai_shd.g_old_rec;
139 If C_Sel1%notfound then
140 Close C_Sel1;
141 --
142 -- The primary key is invalid therefore we must error
143 --
144 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
145 fnd_message.raise_error;
146 End If;
147 Close C_Sel1;
148 If (p_object_version_number
149 <> per_cai_shd.g_old_rec.object_version_number) Then
150 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
151 fnd_message.raise_error;
152 End If;
153 --
154 hr_utility.set_location(' Leaving:'||l_proc, 10);
155 --
156 -- We need to trap the ORA LOCK exception
157 --
158 Exception
159 When HR_Api.Object_Locked then
160 --
161 -- The object is locked therefore we need to supply a meaningful
162 -- error message.
163 --
164 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
165 fnd_message.set_token('TABLE_NAME', 'per_cagr_apis');
166 fnd_message.raise_error;
167 End lck;
168 --
169 -- ----------------------------------------------------------------------------
170 -- |-----------------------------< convert_args >-----------------------------|
171 -- ----------------------------------------------------------------------------
172 Function convert_args
173 (p_cagr_api_id in number
174 ,p_api_name in varchar2
175 ,p_category_name in varchar2
176 ,p_object_version_number in number
177 )
178 Return g_rec_type is
179 --
180 l_rec g_rec_type;
181 --
182 Begin
183 --
184 -- Convert arguments into local l_rec structure.
185 --
186 l_rec.cagr_api_id := p_cagr_api_id;
187 l_rec.api_name := p_api_name;
188 l_rec.category_name := p_category_name;
189 l_rec.object_version_number := p_object_version_number;
190 --
191 -- Return the plsql record structure.
192 --
193 Return(l_rec);
194 --
195 End convert_args;
196 --
197 end per_cai_shd;