[Home] [Help]
PACKAGE BODY: APPS.WMS_DB_OBJECTS_PKG
Source
1 PACKAGE BODY WMS_DB_OBJECTS_PKG AS
2 /* $Header: WMSPDOBB.pls 120.1 2005/06/20 04:52:09 appldev ship $ */
3 --
4 PROCEDURE INSERT_ROW (
5 x_rowid IN OUT NOCOPY /* file.sql.39 change */ VARCHAR2
6 ,x_db_object_id IN NUMBER
7 ,x_last_updated_by IN NUMBER
8 ,x_last_update_date IN DATE
9 ,x_created_by IN NUMBER
10 ,x_creation_date IN DATE
11 ,x_last_update_login IN NUMBER
12 ,x_table_name IN VARCHAR2
13 ,x_table_alias IN VARCHAR2
14 ,x_parent_db_object_id IN NUMBER
15 ,x_context_dependent_flag IN VARCHAR2
16 ,x_context_parameter_id IN NUMBER
17 ,x_user_defined_flag IN VARCHAR2
18 ,x_attribute_category IN VARCHAR2
19 ,x_attribute1 IN VARCHAR2
20 ,x_attribute2 IN VARCHAR2
21 ,x_attribute3 IN VARCHAR2
22 ,x_attribute4 IN VARCHAR2
23 ,x_attribute5 IN VARCHAR2
24 ,x_attribute6 IN VARCHAR2
25 ,x_attribute7 IN VARCHAR2
26 ,x_attribute8 IN VARCHAR2
27 ,x_attribute9 IN VARCHAR2
28 ,x_attribute10 IN VARCHAR2
29 ,x_attribute11 IN VARCHAR2
30 ,x_attribute12 IN VARCHAR2
31 ,x_attribute13 IN VARCHAR2
32 ,x_attribute14 IN VARCHAR2
33 ,x_attribute15 IN VARCHAR2
34 )IS
35 CURSOR C IS SELECT ROWID FROM WMS_DB_OBJECTS
36 WHERE db_object_id = x_db_object_id;
37 BEGIN
38
39 INSERT INTO WMS_DB_OBJECTS (
40 db_object_id
41 ,last_updated_by
42 ,last_update_date
43 ,created_by
44 ,creation_date
45 ,last_update_login
46 ,table_name
47 ,table_alias
48 ,parent_db_object_id
49 ,context_dependent_flag
50 ,context_parameter_id
51 ,user_defined_flag
52 ,attribute_category
53 ,attribute1
54 ,attribute2
55 ,attribute3
56 ,attribute4
57 ,attribute5
58 ,attribute6
59 ,attribute7
60 ,attribute8
61 ,attribute9
62 ,attribute10
63 ,attribute11
64 ,attribute12
65 ,attribute13
66 ,attribute14
67 ,attribute15
68 ) values (
69 x_db_object_id
70 ,x_last_updated_by
71 ,x_last_update_date
72 ,x_created_by
73 ,x_creation_date
74 ,x_last_update_login
75 ,x_table_name
76 ,x_table_alias
77 ,x_parent_db_object_id
78 ,x_context_dependent_flag
79 ,x_context_parameter_id
80 ,x_user_defined_flag
81 ,x_attribute_category
82 ,x_attribute1
83 ,x_attribute2
84 ,x_attribute3
85 ,x_attribute4
86 ,x_attribute5
87 ,x_attribute6
88 ,x_attribute7
89 ,x_attribute8
90 ,x_attribute9
91 ,x_attribute10
92 ,x_attribute11
93 ,x_attribute12
94 ,x_attribute13
95 ,x_attribute14
96 ,x_attribute15
97 );
98
99 OPEN C;
100 FETCH C INTO x_rowid;
101 IF (C%NOTFOUND) THEN
102 CLOSE C;
103 RAISE NO_DATA_FOUND;
104 END IF;
105 CLOSE C;
106 END INSERT_ROW;
107 --
108 PROCEDURE LOCK_ROW (
109 x_rowid IN OUT NOCOPY /* file.sql.39 change */ VARCHAR2
110 ,x_db_object_id IN NUMBER
111 ,x_table_name IN VARCHAR2
112 ,x_table_alias IN VARCHAR2
113 ,x_parent_db_object_id IN NUMBER
114 ,x_context_dependent_flag IN VARCHAR2
115 ,x_context_parameter_id IN NUMBER
116 ,x_user_defined_flag IN VARCHAR2
117 ,x_attribute_category IN VARCHAR2
118 ,x_attribute1 IN VARCHAR2
119 ,x_attribute2 IN VARCHAR2
120 ,x_attribute3 IN VARCHAR2
121 ,x_attribute4 IN VARCHAR2
122 ,x_attribute5 IN VARCHAR2
123 ,x_attribute6 IN VARCHAR2
124 ,x_attribute7 IN VARCHAR2
125 ,x_attribute8 IN VARCHAR2
126 ,x_attribute9 IN VARCHAR2
127 ,x_attribute10 IN VARCHAR2
128 ,x_attribute11 IN VARCHAR2
129 ,x_attribute12 IN VARCHAR2
130 ,x_attribute13 IN VARCHAR2
131 ,x_attribute14 IN VARCHAR2
132 ,x_attribute15 IN VARCHAR2
133 )IS
134 CURSOR C IS SELECT
135 db_object_id
136 ,table_name
137 ,table_alias
138 ,parent_db_object_id
139 ,context_dependent_flag
140 ,context_parameter_id
141 ,user_defined_flag
142 ,attribute_category
143 ,attribute1
144 ,attribute2
145 ,attribute3
146 ,attribute4
147 ,attribute5
148 ,attribute6
149 ,attribute7
150 ,attribute8
151 ,attribute9
152 ,attribute10
153 ,attribute11
154 ,attribute12
155 ,attribute13
156 ,attribute14
157 ,attribute15
158 FROM WMS_DB_OBJECTS
159 WHERE rowid = x_rowid
160 FOR UPDATE OF db_object_id NOWAIT;
161
162 recinfo c%ROWTYPE;
163 BEGIN
164 OPEN c;
165 FETCH c INTO recinfo;
166 IF (c%notfound) THEN
167 CLOSE c;
168 fnd_message.set_name('FND', 'FORM_RECORD_DELETED');
169 app_exception.raise_exception;
170 END IF;
171 CLOSE c;
172 IF ( (recinfo.db_object_id = x_db_object_id)
173 AND (recinfo.table_name = x_table_name)
174 AND (recinfo.table_alias = x_table_alias)
175 AND ((recinfo.parent_db_object_id = x_parent_db_object_id)
176 OR ((recinfo.parent_db_object_id IS NULL)
177 AND (x_parent_db_object_id IS NULL)))
178 AND (recinfo.context_dependent_flag = x_context_dependent_flag)
179 AND ((recinfo.context_parameter_id = x_context_parameter_id)
180 OR ((recinfo.context_parameter_id IS NULL)
181 AND (x_context_parameter_id IS NULL)))
182 AND (recinfo.user_defined_flag = x_user_defined_flag)
183 AND ((recinfo.attribute_category = x_attribute_category)
184 OR ((recinfo.attribute_category IS NULL)
185 AND (x_attribute_category IS NULL)))
186 AND ((recinfo.attribute1 = x_attribute1)
187 OR ((recinfo.attribute1 IS NULL)
188 AND (x_attribute1 IS NULL)))
189 AND ((recinfo.attribute2 = x_attribute2)
190 OR ((recinfo.attribute2 IS NULL)
191 AND (x_attribute2 IS NULL)))
192 AND ((recinfo.attribute3 = x_attribute3)
193 OR ((recinfo.attribute3 IS NULL)
194 AND (x_attribute3 IS NULL)))
195 AND ((recinfo.attribute4 = x_attribute4)
196 OR ((recinfo.attribute4 IS NULL)
197 AND (x_attribute4 IS NULL)))
198 AND ((recinfo.attribute5 = x_attribute5)
199 OR ((recinfo.attribute5 IS NULL)
200 AND (x_attribute5 IS NULL)))
201 AND ((recinfo.attribute6 = x_attribute6)
202 OR ((recinfo.attribute6 IS NULL)
203 AND (x_attribute6 IS NULL)))
204 AND ((recinfo.attribute7 = x_attribute7)
205 OR ((recinfo.attribute7 IS NULL)
206 AND (x_attribute7 IS NULL)))
207 AND ((recinfo.attribute8 = x_attribute8)
208 OR ((recinfo.attribute8 IS NULL)
209 AND (x_attribute8 IS NULL)))
210 AND ((recinfo.attribute9 = x_attribute9)
211 OR ((recinfo.attribute9 IS NULL)
212 AND (x_attribute9 IS NULL)))
213 AND ((recinfo.attribute10 = x_attribute10)
214 OR ((recinfo.attribute10 IS NULL)
215 AND (x_attribute10 IS NULL)))
216 AND ((recinfo.attribute11 = x_attribute11)
217 OR ((recinfo.attribute11 IS NULL)
218 AND (x_attribute11 IS NULL)))
219 AND ((recinfo.attribute12 = x_attribute12)
220 OR ((recinfo.attribute12 IS NULL)
221 AND (x_attribute12 IS NULL)))
222 AND ((recinfo.attribute13 = x_attribute13)
223 OR ((recinfo.attribute13 IS NULL)
224 AND (x_attribute13 IS NULL)))
225 AND ((recinfo.attribute14 = x_attribute14)
226 OR ((recinfo.attribute14 IS NULL)
227 AND (x_attribute14 IS NULL)))
228 AND ((recinfo.attribute15 = x_attribute15)
229 OR ((recinfo.attribute15 IS NULL)
230 AND (x_attribute15 IS NULL)))
231 ) THEN
232 NULL;
233 ELSE
234 fnd_message.set_name('FND','FORM_RECORD_CHANGED');
235 app_exception.raise_exception;
236 END IF;
237 END LOCK_ROW;
238 --
239 PROCEDURE UPDATE_ROW (
240 x_db_object_id IN NUMBER
241 ,x_last_updated_by IN NUMBER
242 ,x_last_update_date IN DATE
243 ,x_last_update_login IN NUMBER
244 ,x_table_name IN VARCHAR2
245 ,x_table_alias IN VARCHAR2
246 ,x_parent_db_object_id IN NUMBER
247 ,x_context_dependent_flag IN VARCHAR2
248 ,x_context_parameter_id IN NUMBER
249 ,x_user_defined_flag IN VARCHAR2
250 ,x_attribute_category IN VARCHAR2
251 ,x_attribute1 IN VARCHAR2
252 ,x_attribute2 IN VARCHAR2
253 ,x_attribute3 IN VARCHAR2
254 ,x_attribute4 IN VARCHAR2
255 ,x_attribute5 IN VARCHAR2
256 ,x_attribute6 IN VARCHAR2
257 ,x_attribute7 IN VARCHAR2
258 ,x_attribute8 IN VARCHAR2
259 ,x_attribute9 IN VARCHAR2
260 ,x_attribute10 IN VARCHAR2
261 ,x_attribute11 IN VARCHAR2
262 ,x_attribute12 IN VARCHAR2
263 ,x_attribute13 IN VARCHAR2
264 ,x_attribute14 IN VARCHAR2
265 ,x_attribute15 IN VARCHAR2
266 )IS
267 BEGIN
268 UPDATE WMS_DB_OBJECTS SET
269 last_updated_by = x_last_updated_by
270 ,last_update_date = x_last_update_date
271 ,last_update_login = x_last_update_login
272 ,table_name = x_table_name
273 ,table_alias = x_table_alias
274 ,parent_db_object_id = x_parent_db_object_id
275 ,context_dependent_flag = x_context_dependent_flag
276 ,context_parameter_id = x_context_parameter_id
277 ,user_defined_flag = x_user_defined_flag
278 ,attribute_category = x_attribute_category
279 ,attribute1 = x_attribute1
280 ,attribute2 = x_attribute2
281 ,attribute3 = x_attribute3
282 ,attribute4 = x_attribute4
283 ,attribute5 = x_attribute5
284 ,attribute6 = x_attribute6
285 ,attribute7 = x_attribute7
286 ,attribute8 = x_attribute8
287 ,attribute9 = x_attribute9
288 ,attribute10 = x_attribute10
289 ,attribute11 = x_attribute11
290 ,attribute12 = x_attribute12
291 ,attribute13 = x_attribute13
292 ,attribute14 = x_attribute14
293 ,attribute15 = x_attribute15
294 WHERE db_object_id = x_db_object_id;
295
296 IF (SQL%NOTFOUND) THEN
297 RAISE NO_DATA_FOUND;
298 END IF;
299 END UPDATE_ROW;
300 --
301 PROCEDURE DELETE_ROW (
302 x_rowid IN VARCHAR2
303 )IS
304 BEGIN
305
306 DELETE FROM WMS_DB_OBJECTS
307 WHERE rowid = x_rowid;
308
309 IF (SQL%NOTFOUND) THEN
310 RAISE NO_DATA_FOUND;
311 END IF;
312 END DELETE_ROW;
313 PROCEDURE load_row
314 (
315 x_db_object_id IN VARCHAR2
316 ,x_owner IN VARCHAR2
317 ,x_table_name IN VARCHAR2
318 ,x_table_alias IN VARCHAR2
319 ,x_parent_db_object_id IN VARCHAR2
320 ,x_context_dependent_flag IN VARCHAR2
321 ,x_context_parameter_id IN VARCHAR2
322 ,x_user_defined_flag IN VARCHAR2
323 ,x_attribute_category IN VARCHAR2
324 ,x_attribute1 IN VARCHAR2
325 ,x_attribute2 IN VARCHAR2
326 ,x_attribute3 IN VARCHAR2
327 ,x_attribute4 IN VARCHAR2
328 ,x_attribute5 IN VARCHAR2
329 ,x_attribute6 IN VARCHAR2
330 ,x_attribute7 IN VARCHAR2
331 ,x_attribute8 IN VARCHAR2
332 ,x_attribute9 IN VARCHAR2
333 ,x_attribute10 IN VARCHAR2
334 ,x_attribute11 IN VARCHAR2
335 ,x_attribute12 IN VARCHAR2
336 ,x_attribute13 IN VARCHAR2
337 ,x_attribute14 IN VARCHAR2
338 ,x_attribute15 IN VARCHAR2
339 ) IS
340 BEGIN
341 DECLARE
342 l_db_object_id NUMBER;
343 l_parent_db_object_id NUMBER;
344 l_context_parameter_id NUMBER;
345 l_user_id NUMBER := 0;
346 l_row_id VARCHAR2(64);
347 l_sysdate DATE;
348 BEGIN
349 IF (x_owner = 'SEED') THEN
350 l_user_id := 1;
351 END IF;
352 --
353 SELECT Sysdate INTO l_sysdate FROM dual;
354 l_db_object_id := fnd_number.canonical_to_number(x_db_object_id);
355 l_parent_db_object_id :=
356 fnd_number.canonical_to_number(x_parent_db_object_id);
357 l_context_parameter_id :=
358 fnd_number.canonical_to_number(x_context_parameter_id);
359 wms_db_objects_pkg.update_row
360 (
361 x_db_object_id => l_db_object_id
362 ,x_last_updated_by => l_user_id
363 ,x_last_update_date => l_sysdate
364 ,x_last_update_login => 0
365 ,x_table_name => x_table_name
366 ,x_table_alias => x_table_alias
367 ,x_parent_db_object_id => l_parent_db_object_id
368 ,x_context_dependent_flag => x_context_dependent_flag
369 ,x_context_parameter_id => l_context_parameter_id
370 ,x_user_defined_flag => x_user_defined_flag
371 ,x_attribute_category => x_attribute_category
372 ,x_attribute1 => x_attribute1
373 ,x_attribute2 => x_attribute2
374 ,x_attribute3 => x_attribute3
375 ,x_attribute4 => x_attribute4
376 ,x_attribute5 => x_attribute5
377 ,x_attribute6 => x_attribute6
378 ,x_attribute7 => x_attribute7
379 ,x_attribute8 => x_attribute8
380 ,x_attribute9 => x_attribute9
381 ,x_attribute10 => x_attribute10
382 ,x_attribute11 => x_attribute11
383 ,x_attribute12 => x_attribute12
384 ,x_attribute13 => x_attribute13
385 ,x_attribute14 => x_attribute14
386 ,x_attribute15 => x_attribute15
387 );
388 EXCEPTION
389 WHEN no_data_found THEN
390 wms_db_objects_pkg.insert_row
391 (
392 x_rowid => l_row_id
393 ,x_db_object_id => l_db_object_id
397 ,x_creation_date => l_sysdate
394 ,x_last_updated_by => l_user_id
395 ,x_last_update_date => l_sysdate
396 ,x_created_by => l_user_id
398 ,x_last_update_login => 0
399 ,x_table_name => x_table_name
400 ,x_table_alias => x_table_alias
401 ,x_parent_db_object_id => l_parent_db_object_id
402 ,x_context_dependent_flag => x_context_dependent_flag
403 ,x_context_parameter_id => l_context_parameter_id
404 ,x_user_defined_flag => x_user_defined_flag
405 ,x_attribute_category => x_attribute_category
406 ,x_attribute1 => x_attribute1
407 ,x_attribute2 => x_attribute2
408 ,x_attribute3 => x_attribute3
409 ,x_attribute4 => x_attribute4
410 ,x_attribute5 => x_attribute5
411 ,x_attribute6 => x_attribute6
412 ,x_attribute7 => x_attribute7
413 ,x_attribute8 => x_attribute8
414 ,x_attribute9 => x_attribute9
415 ,x_attribute10 => x_attribute10
416 ,x_attribute11 => x_attribute11
417 ,x_attribute12 => x_attribute12
418 ,x_attribute13 => x_attribute13
419 ,x_attribute14 => x_attribute14
420 ,x_attribute15 => x_attribute15
421 );
422 END;
423 END load_row;
424 END WMS_DB_OBJECTS_PKG;