DBA Data[Home] [Help]

PACKAGE BODY: APPS.FA_CEILING_TYPES_PKG

Source


1 PACKAGE BODY FA_CEILING_TYPES_PKG as
2 /* $Header: faxictyb.pls 120.6 2005/07/28 00:20:36 tkawamur ship $ */
3 
4 procedure INSERT_ROW (
5   X_ROWID in out nocopy VARCHAR2,
6   X_CEILING_NAME in VARCHAR2,
7   X_CEILING_TYPE in VARCHAR2,
8   X_CURRENCY_CODE in VARCHAR2,
9   X_DESCRIPTION in VARCHAR2,
10   X_ATTRIBUTE1 in VARCHAR2,
11   X_ATTRIBUTE2 in VARCHAR2,
12   X_ATTRIBUTE3 in VARCHAR2,
13   X_ATTRIBUTE4 in VARCHAR2,
14   X_ATTRIBUTE5 in VARCHAR2,
15   X_ATTRIBUTE6 in VARCHAR2,
16   X_ATTRIBUTE7 in VARCHAR2,
17   X_ATTRIBUTE8 in VARCHAR2,
18   X_ATTRIBUTE9 in VARCHAR2,
19   X_ATTRIBUTE10 in VARCHAR2,
20   X_ATTRIBUTE11 in VARCHAR2,
21   X_ATTRIBUTE12 in VARCHAR2,
22   X_ATTRIBUTE13 in VARCHAR2,
23   X_ATTRIBUTE14 in VARCHAR2,
24   X_ATTRIBUTE15 in VARCHAR2,
25   X_ATTRIBUTE_CATEGORY_CODE in VARCHAR2,
26   X_CREATION_DATE in DATE,
27   X_CREATED_BY in NUMBER,
28   X_LAST_UPDATE_DATE in DATE,
29   X_LAST_UPDATED_BY in NUMBER,
30   X_LAST_UPDATE_LOGIN in NUMBER,
31   p_log_level_rec    in      fa_api_types.log_level_rec_type default null) is
32 
33   CURSOR C is SELECT rowid FROM fa_ceiling_types
34               WHERE  ceiling_name = X_Ceiling_Name;
35 begin
36 
37   INSERT INTO fa_ceiling_types (
38 	ceiling_type,
39 	ceiling_name,
40 	currency_code,
41 	description,
42 	attribute1,
43 	attribute2,
44 	attribute3,
45 	attribute4,
46 	attribute5,
47 	attribute6,
48 	attribute7,
49 	attribute8,
50 	attribute9,
51 	attribute10,
52 	attribute11,
53 	attribute12,
54 	attribute13,
55 	attribute14,
56 	attribute15,
57 	attribute_category_code,
58 	creation_date,
59 	created_by,
60 	last_update_date,
61 	last_updated_by,
62 	last_update_login
63   ) VALUES (
64 	X_Ceiling_Type,
65 	X_Ceiling_Name,
66 	X_Currency_Code,
67 	X_Description,
68 	X_Attribute1,
69 	X_Attribute2,
70 	X_Attribute3,
71 	X_Attribute4,
72 	X_Attribute5,
73 	X_Attribute6,
74 	X_Attribute7,
75 	X_Attribute8,
76 	X_Attribute9,
77 	X_Attribute10,
78 	X_Attribute11,
79 	X_Attribute12,
80 	X_Attribute13,
81 	X_Attribute14,
82 	X_Attribute15,
83 	X_Attribute_Category_Code,
84 	X_Creation_Date,
85 	X_Created_By,
86 	X_Last_Update_Date,
87 	X_Last_Updated_By,
88 	X_Last_Update_Login
89   );
90 
91   OPEN C;
92   FETCH C INTO X_Rowid;
93   if (C%NOTFOUND) then
94      CLOSE C;
95      Raise NO_DATA_FOUND;
96   end if;
97   CLOSE C;
98 
99 exception
100   when others then
101         fa_srvr_msg.add_sql_error(
102                 calling_fn => 'fa_ceiling_types_pkg.insert_row'
103                 ,p_log_level_rec => p_log_level_rec);
104         raise;
105 
106 end INSERT_ROW;
107 
108 procedure LOCK_ROW (
109   X_CEILING_NAME in VARCHAR2,
110   X_CEILING_TYPE in VARCHAR2,
111   X_CURRENCY_CODE in VARCHAR2,
112   X_DESCRIPTION in VARCHAR2,
113   X_ATTRIBUTE1 in VARCHAR2,
114   X_ATTRIBUTE2 in VARCHAR2,
115   X_ATTRIBUTE3 in VARCHAR2,
116   X_ATTRIBUTE4 in VARCHAR2,
117   X_ATTRIBUTE5 in VARCHAR2,
118   X_ATTRIBUTE6 in VARCHAR2,
119   X_ATTRIBUTE7 in VARCHAR2,
120   X_ATTRIBUTE8 in VARCHAR2,
121   X_ATTRIBUTE9 in VARCHAR2,
122   X_ATTRIBUTE10 in VARCHAR2,
123   X_ATTRIBUTE11 in VARCHAR2,
124   X_ATTRIBUTE12 in VARCHAR2,
125   X_ATTRIBUTE13 in VARCHAR2,
126   X_ATTRIBUTE14 in VARCHAR2,
127   X_ATTRIBUTE15 in VARCHAR2,
128   X_ATTRIBUTE_CATEGORY_CODE in VARCHAR2,
129   p_log_level_rec    in      fa_api_types.log_level_rec_type default null) is
130   CURSOR C is
131       SELECT ceiling_name,
132              ceiling_type,
133              currency_code,
134              description,
135              attribute1,
136              attribute2,
137              attribute3,
138              attribute4,
139              attribute5,
140              attribute6,
141              attribute7,
142              attribute8,
143              attribute9,
144              attribute10,
145              attribute11,
146              attribute12,
147              attribute13,
148              attribute14,
149              attribute15,
150              attribute_category_code
151       FROM   fa_ceiling_types
152       WHERE  ceiling_name = X_Ceiling_Name
153       FOR UPDATE of ceiling_name NOWAIT;
154   Recinfo C%ROWTYPE;
155 
156 begin
157 
158   OPEN C;
159   FETCH C INTO Recinfo;
160   if (C%NOTFOUND) then
161       CLOSE C;
162       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_DELETED');
163       APP_EXCEPTION.Raise_Exception;
164   end if;
165   CLOSE C;
166   if (
167           (Recinfo.Ceiling_Name = X_Ceiling_Name)
168       AND (Recinfo.Ceiling_Type = X_Ceiling_Type)
169       AND (Recinfo.Currency_Code = X_Currency_Code)
170       AND (Recinfo.Description = X_Description)
171       AND ((Recinfo.Attribute1 = X_Attribute1)
172           OR ((Recinfo.Attribute1 IS NULL)
173           AND (X_Attribute1 IS NULL)))
174       AND ((Recinfo.Attribute2 = X_Attribute2)
175           OR ((Recinfo.Attribute2 IS NULL)
176           AND (X_Attribute2 IS NULL)))
177       AND ((Recinfo.Attribute3 = X_Attribute3)
178           OR ((Recinfo.Attribute3 IS NULL)
179           AND (X_Attribute3 IS NULL)))
180       AND ((Recinfo.Attribute4 = X_Attribute4)
181           OR ((Recinfo.Attribute4 IS NULL)
182           AND (X_Attribute4 IS NULL)))
183       AND ((Recinfo.Attribute5 = X_Attribute5)
184           OR ((Recinfo.Attribute5 IS NULL)
185           AND (X_Attribute5 IS NULL)))
186       AND ((Recinfo.Attribute6 = X_Attribute6)
187           OR ((Recinfo.Attribute6 IS NULL)
188           AND (X_Attribute6 IS NULL)))
189       AND ((Recinfo.Attribute7 = X_Attribute7)
190           OR ((Recinfo.Attribute7 IS NULL)
191           AND (X_Attribute7 IS NULL)))
192       AND ((Recinfo.Attribute8 = X_Attribute8)
193           OR ((Recinfo.Attribute8 IS NULL)
194           AND (X_Attribute8 IS NULL)))
195       AND ((Recinfo.Attribute9 = X_Attribute9)
196           OR ((Recinfo.Attribute9 IS NULL)
197           AND (X_Attribute9 IS NULL)))
198       AND ((Recinfo.Attribute10 = X_Attribute10)
199           OR ((Recinfo.Attribute10 IS NULL)
200           AND (X_Attribute10 IS NULL)))
201       AND ((Recinfo.Attribute11 = X_Attribute11)
202           OR ((Recinfo.Attribute11 IS NULL)
203           AND (X_Attribute11 IS NULL)))
204       AND ((Recinfo.Attribute12 = X_Attribute12)
205           OR ((Recinfo.Attribute12 IS NULL)
206           AND (X_Attribute12 IS NULL)))
207       AND ((Recinfo.Attribute13 = X_Attribute13)
208           OR ((Recinfo.Attribute13 IS NULL)
209           AND (X_Attribute13 IS NULL)))
210       AND ((Recinfo.Attribute14 = X_Attribute14)
211           OR ((Recinfo.Attribute14 IS NULL)
212           AND (X_Attribute14 IS NULL)))
213       AND ((Recinfo.Attribute15 = X_Attribute15)
214           OR ((Recinfo.Attribute15 IS NULL)
215           AND (X_Attribute15 IS NULL)))
216       AND ((Recinfo.Attribute_Category_Code = X_Attribute_Category_Code)
217           OR ((Recinfo.Attribute_Category_Code IS NULL)
218           AND (X_Attribute_Category_Code IS NULL)))) then
219       return;
220   else
221       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
222       APP_EXCEPTION.Raise_Exception;
223   end if;
224 
225 end LOCK_ROW;
226 
227 procedure UPDATE_ROW (
228   X_CEILING_NAME in VARCHAR2,
229   X_CEILING_TYPE in VARCHAR2,
230   X_CURRENCY_CODE in VARCHAR2,
231   X_DESCRIPTION in VARCHAR2,
232   X_ATTRIBUTE1 in VARCHAR2,
233   X_ATTRIBUTE2 in VARCHAR2,
234   X_ATTRIBUTE3 in VARCHAR2,
235   X_ATTRIBUTE4 in VARCHAR2,
236   X_ATTRIBUTE5 in VARCHAR2,
237   X_ATTRIBUTE6 in VARCHAR2,
238   X_ATTRIBUTE7 in VARCHAR2,
239   X_ATTRIBUTE8 in VARCHAR2,
240   X_ATTRIBUTE9 in VARCHAR2,
241   X_ATTRIBUTE10 in VARCHAR2,
242   X_ATTRIBUTE11 in VARCHAR2,
243   X_ATTRIBUTE12 in VARCHAR2,
244   X_ATTRIBUTE13 in VARCHAR2,
245   X_ATTRIBUTE14 in VARCHAR2,
246   X_ATTRIBUTE15 in VARCHAR2,
247   X_ATTRIBUTE_CATEGORY_CODE in VARCHAR2,
248   X_LAST_UPDATE_DATE in DATE,
249   X_LAST_UPDATED_BY in NUMBER,
250   X_LAST_UPDATE_LOGIN in NUMBER,
251   p_log_level_rec    in      fa_api_types.log_level_rec_type default null) is
252 
253 begin
254 
255   UPDATE fa_ceiling_types
256   SET    ceiling_name = X_Ceiling_Name,
257          ceiling_type = X_Ceiling_Type,
258          currency_code = X_Currency_Code,
259          description = X_Description,
260          attribute1 = X_Attribute1,
261          attribute2 = X_Attribute2,
262          attribute3 = X_Attribute3,
263          attribute4 = X_Attribute4,
264          attribute5 = X_Attribute5,
265          attribute6 = X_Attribute5,
266          attribute7 = X_Attribute7,
267          attribute8 = X_Attribute8,
268          attribute9 = X_Attribute9,
269          attribute10 = X_Attribute10,
270          attribute11 = X_Attribute11,
271          attribute12 = X_Attribute12,
272          attribute13 = X_Attribute13,
273          attribute14 = X_Attribute14,
274          attribute15 = X_Attribute15,
275          attribute_category_code = X_Attribute_Category_Code,
276          last_update_date = X_Last_Update_Date,
277          last_updated_by = X_Last_Updated_By,
278          last_update_login = X_Last_Update_Login
279   WHERE  ceiling_name = X_Ceiling_Name;
280 
281   if (SQL%NOTFOUND) then
282      Raise NO_DATA_FOUND;
283   end if;
284 
285   exception
286     when others then
287         fa_srvr_msg.add_sql_error(
288                 calling_fn => 'fa_ceiling_types_pkg.update_row'
289                 ,p_log_level_rec => p_log_level_rec);
290         raise;
291 
292 end UPDATE_ROW;
293 
294 procedure DELETE_ROW (
295   X_CEILING_NAME in VARCHAR2
296  ,p_log_level_rec    in      fa_api_types.log_level_rec_type default null) is
297 
298 begin
299 
300   DELETE FROM fa_ceiling_types
301   WHERE  ceiling_name = X_Ceiling_Name;
302 
303   if (SQL%NOTFOUND) then
304      Raise NO_DATA_FOUND;
305   end if;
306 
307   exception
308     when others then
309         fa_srvr_msg.add_sql_error(
310                 calling_fn => 'fa_ceiling_types_pkg.delete_row'
311                 ,p_log_level_rec => p_log_level_rec);
312         raise;
313 
314 end DELETE_ROW;
315 
316 procedure LOAD_ROW (
317   X_CUSTOM_MODE in VARCHAR2,
318   X_CEILING_TYPE in VARCHAR2,
319   X_CEILING_NAME in VARCHAR2,
320   X_OWNER in VARCHAR2,
321   X_LAST_UPDATE_DATE in DATE,
322   X_CURRENCY_CODE in VARCHAR2,
323   X_DESCRIPTION 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   X_ATTRIBUTE_CATEGORY_CODE in VARCHAR2,
340   p_log_level_rec        IN     FA_API_TYPES.log_level_rec_type default null) is
341 
342   h_record_exists       number(15);
343 
344   user_id               number;
345   row_id                varchar2(64);
346 
347   db_last_updated_by    number;
348   db_last_update_date   date;
349 
350 begin
351 
352   user_id := fnd_load_util.owner_id (X_Owner);
353 
354   select count(*)
355   into h_record_exists
356   from fa_ceiling_types
357   where ceiling_name = X_Ceiling_Name;
358 
359   if (h_record_exists > 0) then
360 
361      select last_updated_by, last_update_date
362      into   db_last_updated_by, db_last_update_date
363      from fa_ceiling_types
364      where ceiling_name = X_Ceiling_Name;
365 
366      if (fnd_load_util.upload_test(user_id, x_last_update_date,
367                                    db_last_updated_by, db_last_update_date,
368                                    X_CUSTOM_MODE)) then
369 
370         fa_ceiling_types_pkg.update_row (
371            X_Ceiling_Type              => X_Ceiling_Type,
372            X_Ceiling_Name              => X_Ceiling_Name,
373            X_Currency_Code             => X_Currency_Code,
374            X_Description               => X_Description,
375            X_Attribute1                => X_Attribute1,
376            X_Attribute2                => X_Attribute2,
377            X_Attribute3                => X_Attribute3,
378            X_Attribute4                => X_Attribute4,
379            X_Attribute5                => X_Attribute5,
380            X_Attribute6                => X_Attribute6,
381            X_Attribute7                => X_Attribute7,
382            X_Attribute8                => X_Attribute8,
383            X_Attribute9                => X_Attribute9,
384            X_Attribute10               => X_Attribute10,
385            X_Attribute11               => X_Attribute11,
386            X_Attribute12               => X_Attribute12,
387            X_Attribute13               => X_Attribute13,
388            X_Attribute14               => X_Attribute14,
389            X_Attribute15               => X_Attribute15,
390            X_Attribute_Category_Code   => X_Attribute_Category_Code,
391            X_Last_Update_Date		=> sysdate,
392            X_Last_Updated_By		=> user_id,
393            X_Last_Update_Login		=> 0
394            ,p_log_level_rec => p_log_level_rec);
395      end if;
396   else
397      fa_ceiling_types_pkg.insert_row (
398 	X_Rowid				=> row_id,
399 	X_Ceiling_Type			=> X_Ceiling_Type,
400 	X_Ceiling_Name			=> X_Ceiling_Name,
401 	X_Currency_Code			=> X_Currency_Code,
402 	X_Description			=> X_Description,
403 	X_Attribute1			=> X_Attribute1,
404 	X_Attribute2			=> X_Attribute2,
405 	X_Attribute3			=> X_Attribute3,
406 	X_Attribute4			=> X_Attribute4,
407 	X_Attribute5			=> X_Attribute5,
408 	X_Attribute6			=> X_Attribute6,
409 	X_Attribute7			=> X_Attribute7,
410 	X_Attribute8			=> X_Attribute8,
411 	X_Attribute9			=> X_Attribute9,
412 	X_Attribute10			=> X_Attribute10,
413 	X_Attribute11			=> X_Attribute11,
414 	X_Attribute12			=> X_Attribute12,
415 	X_Attribute13			=> X_Attribute13,
416 	X_Attribute14			=> X_Attribute14,
417 	X_Attribute15			=> X_Attribute15,
418 	X_Attribute_Category_Code	=> X_Attribute_Category_Code,
419 	X_Creation_Date			=> sysdate,
420 	X_Created_By			=> user_id,
421 	X_Last_Update_Date		=> sysdate,
422 	X_Last_Updated_By		=> user_id,
423 	X_Last_Update_Login		=> 0
424 	,p_log_level_rec => p_log_level_rec);
425   end if;
426 
427 exception
428   when others then
429        FA_STANDARD_PKG.RAISE_ERROR(
430                       CALLED_FN => 'fa_ceiling_types.load_row',
431                       CALLING_FN => 'upload fa_ceiling_types'
432                       ,p_log_level_rec => p_log_level_rec);
433 
434 end LOAD_ROW;
435 
436 PROCEDURE LOAD_SEED_ROW (
437           x_upload_mode                 IN VARCHAR2,
438           x_custom_mode                 IN VARCHAR2,
439           x_ceiling_type                IN VARCHAR2,
440           x_ceiling_name                IN VARCHAR2,
441           x_owner                       IN VARCHAR2,
442           x_last_update_date            IN DATE,
443           x_currency_code               IN VARCHAR2,
444           x_description                 IN VARCHAR2,
445           x_attribute1                  IN VARCHAR2,
446           x_attribute2                  IN VARCHAR2,
447           x_attribute3                  IN VARCHAR2,
448           x_attribute4                  IN VARCHAR2,
449           x_attribute5                  IN VARCHAR2,
450           x_attribute6                  IN VARCHAR2,
451           x_attribute7                  IN VARCHAR2,
452           x_attribute8                  IN VARCHAR2,
453           x_attribute9                  IN VARCHAR2,
454           x_attribute10                 IN VARCHAR2,
455           x_attribute11                 IN VARCHAR2,
456           x_attribute12                 IN VARCHAR2,
457           x_attribute13                 IN VARCHAR2,
458           x_attribute14                 IN VARCHAR2,
459           x_attribute15                 IN VARCHAR2,
460           x_attribute_category_code     IN VARCHAR2) IS
461 
462 
463 BEGIN
464 
465       if (x_upload_mode = 'NLS') then
466          null;
467       else
468         fa_ceiling_types_pkg.LOAD_ROW (
469           x_custom_mode                 => x_custom_mode,
470           x_ceiling_type                => x_ceiling_type,
471           x_ceiling_name                => x_ceiling_name,
472           x_owner                       => x_owner,
473           x_last_update_date            => x_last_update_date,
474           x_currency_code               => x_currency_code,
475           x_description                 => x_description,
476           x_attribute1                  => x_attribute1,
477           x_attribute2                  => x_attribute2,
478           x_attribute3                  => x_attribute3,
479           x_attribute4                  => x_attribute4,
480           x_attribute5                  => x_attribute5,
481           x_attribute6                  => x_attribute6,
482           x_attribute7                  => x_attribute7,
483           x_attribute8                  => x_attribute8,
484           x_attribute9                  => x_attribute9,
485           x_attribute10                 => x_attribute10,
486           x_attribute11                 => x_attribute11,
487           x_attribute12                 => x_attribute12,
488           x_attribute13                 => x_attribute13,
489           x_attribute14                 => x_attribute14,
490           x_attribute15                 => x_attribute15,
491           x_attribute_category_code     => x_attribute_category_code);
492 
493       end if;
494 
495 END LOAD_SEED_ROW;
496 
497 END FA_CEILING_TYPES_PKG;