[Home] [Help]
PACKAGE BODY: APPS.OTA_COI_SHD
Source
1 Package Body ota_coi_shd as
2 /* $Header: otcoirhi.pkb 120.3 2005/08/12 02:46 pchandra noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ota_coi_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 = 'OTA_CHAT_OBJ_INCLUSIONS_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_chat_id in number
40 ,p_object_id in number
41 ,p_object_type in varchar2
42 ,p_object_version_number in number
43 )
44 Return Boolean Is
45 --
46 --
47 -- Cursor selects the 'current' row from the HR Schema
48 --
49 Cursor C_Sel1 is
50 select
51 chat_id
52 ,object_id
53 ,object_type
54 ,start_date_active
55 ,end_date_active
56 ,primary_flag
57 ,object_version_number
58 from ota_chat_obj_inclusions
59 where chat_id = p_chat_id
60 and object_id = p_object_id
61 and object_type = p_object_type;
62 --
63 l_fct_ret boolean;
64 --
65 Begin
66 --
67 If (p_chat_id is null and
68 p_object_id is null and
69 p_object_type is null and
70 p_object_version_number is null
71 ) Then
72 --
73 -- One of the primary key arguments is null therefore we must
74 -- set the returning function value to false
75 --
76 l_fct_ret := false;
77 Else
78 If (p_chat_id
79 = ota_coi_shd.g_old_rec.chat_id and
80 p_object_id
81 = ota_coi_shd.g_old_rec.object_id and
82 p_object_type
83 = ota_coi_shd.g_old_rec.object_type and
84 p_object_version_number
85 = ota_coi_shd.g_old_rec.object_version_number
86 ) Then
87 --
88 -- The g_old_rec is current therefore we must
89 -- set the returning function to true
90 --
91 l_fct_ret := true;
92 Else
93 --
94 -- Select the current row into g_old_rec
95 --
96 Open C_Sel1;
97 Fetch C_Sel1 Into ota_coi_shd.g_old_rec;
98 If C_Sel1%notfound Then
99 Close C_Sel1;
100 --
101 -- The primary key is invalid therefore we must error
102 --
103 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
104 fnd_message.raise_error;
105 End If;
106 Close C_Sel1;
107 If (p_object_version_number
108 <> ota_coi_shd.g_old_rec.object_version_number) Then
109 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
110 fnd_message.raise_error;
111 End If;
112 l_fct_ret := true;
113 End If;
114 End If;
115 Return (l_fct_ret);
116 --
117 End api_updating;
118 --
119 -- ----------------------------------------------------------------------------
120 -- |---------------------------------< lck >----------------------------------|
121 -- ----------------------------------------------------------------------------
122 Procedure lck
123 (p_chat_id in number
124 ,p_object_id in number
125 ,p_object_type in varchar2
126 ,p_object_version_number in number
127 ) is
128 --
129 -- Cursor selects the 'current' row from the HR Schema
130 --
131 Cursor C_Sel1 is
132 select
133 chat_id
134 ,object_id
135 ,object_type
136 ,start_date_active
137 ,end_date_active
138 ,primary_flag
139 ,object_version_number
140 from ota_chat_obj_inclusions
141 where chat_id = p_chat_id
142 and object_id = p_object_id
143 and object_type = p_object_type
144 for update nowait;
145 --
146 l_proc varchar2(72) := g_package||'lck';
147 --
148 Begin
149 hr_utility.set_location('Entering:'||l_proc, 5);
150 --
151 hr_api.mandatory_arg_error
152 (p_api_name => l_proc
153 ,p_argument => 'CHAT_ID'
154 ,p_argument_value => p_chat_id
155 );
156 hr_utility.set_location(l_proc,6);
157 hr_api.mandatory_arg_error
158 (p_api_name => l_proc
159 ,p_argument => 'OBJECT_ID'
160 ,p_argument_value => p_object_id
161 );
162 hr_utility.set_location(l_proc,7);
163 hr_api.mandatory_arg_error
164 (p_api_name => l_proc
165 ,p_argument => 'OBJECT_TYPE'
166 ,p_argument_value => p_object_type
167 );
168 hr_utility.set_location(l_proc,8);
169 hr_api.mandatory_arg_error
170 (p_api_name => l_proc
171 ,p_argument => 'OBJECT_VERSION_NUMBER'
172 ,p_argument_value => p_object_version_number
173 );
174 --
175 Open C_Sel1;
176 Fetch C_Sel1 Into ota_coi_shd.g_old_rec;
177 If C_Sel1%notfound then
178 Close C_Sel1;
179 --
180 -- The primary key is invalid therefore we must error
181 --
182 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
183 fnd_message.raise_error;
184 End If;
185 Close C_Sel1;
186 If (p_object_version_number
187 <> ota_coi_shd.g_old_rec.object_version_number) Then
188 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
189 fnd_message.raise_error;
190 End If;
191 --
192 hr_utility.set_location(' Leaving:'||l_proc, 10);
193 --
194 -- We need to trap the ORA LOCK exception
195 --
196 Exception
197 When HR_Api.Object_Locked then
198 --
199 -- The object is locked therefore we need to supply a meaningful
200 -- error message.
201 --
202 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
203 fnd_message.set_token('TABLE_NAME', 'ota_chat_obj_inclusions');
204 fnd_message.raise_error;
205 End lck;
206 --
207 -- ----------------------------------------------------------------------------
208 -- |-----------------------------< convert_args >-----------------------------|
209 -- ----------------------------------------------------------------------------
210 Function convert_args
211 (p_chat_id in number
212 ,p_object_id in number
213 ,p_object_type in varchar2
214 ,p_start_date_active in date
215 ,p_end_date_active in date
216 ,p_primary_flag in varchar2
217 ,p_object_version_number in number
218 )
219 Return g_rec_type is
220 --
221 l_rec g_rec_type;
222 --
223 Begin
224 --
225 -- Convert arguments into local l_rec structure.
226 --
227 l_rec.chat_id := p_chat_id;
228 l_rec.object_id := p_object_id;
229 l_rec.object_type := p_object_type;
230 l_rec.start_date_active := p_start_date_active;
231 l_rec.end_date_active := p_end_date_active;
232 l_rec.primary_flag := p_primary_flag;
233 l_rec.object_version_number := p_object_version_number;
234 --
235 -- Return the plsql record structure.
236 --
237 Return(l_rec);
238 --
239 End convert_args;
240 --
241 end ota_coi_shd;