DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGI_IAC_PROJ_DETAILS_PKG

Source


1 PACKAGE BODY igi_iac_proj_details_pkg AS
2 /* $Header: igiiapdb.pls 120.5.12000000.1 2007/08/01 16:15:47 npandya ship $ */
3 
4 --===========================FND_LOG.START=====================================
5 
6 g_state_level NUMBER	     :=	FND_LOG.LEVEL_STATEMENT;
7 g_proc_level  NUMBER	     :=	FND_LOG.LEVEL_PROCEDURE;
8 g_event_level NUMBER	     :=	FND_LOG.LEVEL_EVENT;
9 g_excep_level NUMBER	     :=	FND_LOG.LEVEL_EXCEPTION;
10 g_error_level NUMBER	     :=	FND_LOG.LEVEL_ERROR;
11 g_unexp_level NUMBER	     :=	FND_LOG.LEVEL_UNEXPECTED;
12 g_path        VARCHAR2(100)  := 'IGI.PLSQL.igiiapdb.igi_iac_proj_details_pkg.';
13 
14 --===========================FND_LOG.END=======================================
15 
16   l_rowid VARCHAR2(25);
17   old_references igi_iac_proj_details%ROWTYPE;
18   new_references igi_iac_proj_details%ROWTYPE;
19 
20   PROCEDURE set_column_values (
21     p_action                            IN     VARCHAR2,
22     x_rowid                             IN     VARCHAR2   ,
23     x_projection_id                     IN     NUMBER     ,
24     x_period_counter                    IN     NUMBER     ,
25     x_fiscal_year                       IN     NUMBER     ,
26     x_company                           IN     VARCHAR2    ,
27     x_cost_center                       IN     VARCHAR2    ,
28     x_account                           IN     VARCHAR2    ,
29     x_asset_id                          IN     NUMBER      ,
30     x_latest_reval_cost                 IN     NUMBER      ,
31     x_deprn_period                      IN     NUMBER      ,
32     x_deprn_ytd                         IN     NUMBER      ,
33     x_deprn_reserve                     IN     NUMBER      ,
34     x_asset_exception                   IN     VARCHAR2    ,
35     x_revaluation_flag                  IN     VARCHAR2    ,
36     x_creation_date                     IN     DATE        ,
37     x_created_by                        IN     NUMBER      ,
38     x_last_update_date                  IN     DATE        ,
39     x_last_updated_by                   IN     NUMBER    ,
40     x_last_update_login                 IN     NUMBER
41   ) AS
42   /*
43   ||  Created By : [email protected]
44   ||  Created On : 30-MAY-2002
45   ||  Purpose : Initialises the Old and New references for the columns of the table.
46   ||  Known limitations, enhancements or remarks :
47   ||  Change History :
48   ||  Who             When            What
49   ||  (reverse chronological order - newest change first)
50   */
51 
52     CURSOR cur_old_ref_values IS
53       SELECT   *
54       FROM     igi_iac_proj_details
55       WHERE    rowid = x_rowid;
56     l_path varchar2(150) := g_path||'set_column_values';
57   BEGIN
58 
59     l_rowid := x_rowid;
60 
61     -- Code for setting the Old and New Reference Values.
62     -- Populate Old Values.
63     OPEN cur_old_ref_values;
64     FETCH cur_old_ref_values INTO old_references;
65     IF ((cur_old_ref_values%NOTFOUND) AND (p_action NOT IN ('INSERT', 'VALIDATE_INSERT'))) THEN
66       CLOSE cur_old_ref_values;
67       fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
68       igi_iac_debug_pkg.debug_other_msg(g_error_level,l_path,FALSE);
69       app_exception.raise_exception;
70       RETURN;
71     END IF;
72     CLOSE cur_old_ref_values;
73 
74     -- Populate New Values.
75     new_references.projection_id                     := x_projection_id;
76     new_references.period_counter                    := x_period_counter;
77     new_references.fiscal_year                       := x_fiscal_year;
78     new_references.company                           := x_company;
79     new_references.cost_center                       := x_cost_center;
80     new_references.account                           := x_account;
81     new_references.asset_id                          := x_asset_id;
82     new_references.latest_reval_cost                 := x_latest_reval_cost;
83     new_references.deprn_period                      := x_deprn_period;
84     new_references.deprn_ytd                         := x_deprn_ytd;
85     new_references.deprn_reserve                     := x_deprn_reserve;
86     new_references.asset_exception                   := x_asset_exception;
87     new_references.revaluation_flag                  := x_revaluation_flag;
88 
89     IF (p_action = 'UPDATE') THEN
90       new_references.creation_date                   := old_references.creation_date;
91       new_references.created_by                      := old_references.created_by;
92     ELSE
93       new_references.creation_date                   := x_creation_date;
94       new_references.created_by                      := x_created_by;
95     END IF;
96 
97     new_references.last_update_date                  := x_last_update_date;
98     new_references.last_updated_by                   := x_last_updated_by;
99     new_references.last_update_login                 := x_last_update_login;
100 
101   END set_column_values;
102 
103 
104   PROCEDURE check_parent_existance AS
105   /*
106   ||  Created By : [email protected]
107   ||  Created On : 30-MAY-2002
108   ||  Purpose : Checks for the existance of Parent records.
109   ||  Known limitations, enhancements or remarks :
110   ||  Change History :
111   ||  Who             When            What
112   ||  (reverse chronological order - newest change first)
113   */
114     l_path varchar2(150) := g_path||'check_parent_existance';
115   BEGIN
116 
117     IF (((old_references.projection_id = new_references.projection_id)) OR
118         ((new_references.projection_id IS NULL))) THEN
119       NULL;
120     ELSIF NOT igi_iac_projections_pkg.get_pk_for_validation (
121                 new_references.projection_id
122               ) THEN
123       fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
124       igi_iac_debug_pkg.debug_other_msg(g_error_level,l_path,FALSE);
125       app_exception.raise_exception;
126     END IF;
127 
128   END check_parent_existance;
129 
130 
131   FUNCTION get_pk_for_validation (
132     x_projection_id                     IN     NUMBER,
133     x_asset_id                          IN     NUMBER,
134     x_period_counter                    IN     NUMBER
135   ) RETURN BOOLEAN AS
136   /*
137   ||  Created By : [email protected]
138   ||  Created On : 30-MAY-2002
139   ||  Purpose : Validates the Primary Key of the table.
140   ||  Known limitations, enhancements or remarks :
141   ||  Change History :
142   ||  Who             When            What
143   ||  (reverse chronological order - newest change first)
144   */
145     CURSOR cur_rowid IS
146       SELECT   rowid
147       FROM     igi_iac_proj_details
148       WHERE    projection_id = x_projection_id
149       AND      asset_id = x_asset_id
150       AND      period_counter = x_period_counter
151       FOR UPDATE NOWAIT;
152 
153     lv_rowid cur_rowid%RowType;
154 
155   BEGIN
156 
157     OPEN cur_rowid;
158     FETCH cur_rowid INTO lv_rowid;
159     IF (cur_rowid%FOUND) THEN
160       CLOSE cur_rowid;
161       RETURN(TRUE);
162     ELSE
163       CLOSE cur_rowid;
164       RETURN(FALSE);
165     END IF;
166 
167   END get_pk_for_validation;
168 
169 
170   PROCEDURE get_fk_igi_iac_projections (
171     x_projection_id                     IN     NUMBER
172   ) AS
173   /*
174   ||  Created By : [email protected]
175   ||  Created On : 30-MAY-2002
176   ||  Purpose : Validates the Foreign Keys for the table.
177   ||  Known limitations, enhancements or remarks :
178   ||  Change History :
179   ||  Who             When            What
180   ||  (reverse chronological order - newest change first)
181   */
182     CURSOR cur_rowid IS
183       SELECT   rowid
184       FROM     igi_iac_proj_details
185       WHERE   ((projection_id = x_projection_id));
186 
187     lv_rowid cur_rowid%RowType;
188     l_path varchar2(150) := g_path||'get_fk_igi_iac_projections';
189   BEGIN
190 
191     OPEN cur_rowid;
192     FETCH cur_rowid INTO lv_rowid;
193     IF (cur_rowid%FOUND) THEN
194       CLOSE cur_rowid;
195       fnd_message.set_name ('FND', 'FND-CANNOT DELETE MASTER');
196       igi_iac_debug_pkg.debug_other_msg(g_error_level,l_path,FALSE);
197       app_exception.raise_exception;
198       RETURN;
199     END IF;
200     CLOSE cur_rowid;
201 
202   END get_fk_igi_iac_projections;
203 
204 
205   PROCEDURE before_dml (
206     p_action                            IN     VARCHAR2,
207     x_rowid                             IN     VARCHAR2   ,
208     x_projection_id                     IN     NUMBER      ,
209     x_period_counter                    IN     NUMBER      ,
210     x_fiscal_year                       IN     NUMBER      ,
211     x_company                           IN     VARCHAR2    ,
212     x_cost_center                       IN     VARCHAR2    ,
213     x_account                           IN     VARCHAR2    ,
214     x_asset_id                          IN     NUMBER      ,
215     x_latest_reval_cost                 IN     NUMBER      ,
216     x_deprn_period                      IN     NUMBER      ,
217     x_deprn_ytd                         IN     NUMBER      ,
218     x_deprn_reserve                     IN     NUMBER      ,
219     x_asset_exception                   IN     VARCHAR2    ,
220     x_revaluation_flag                  IN     VARCHAR2    ,
221     x_creation_date                     IN     DATE        ,
222     x_created_by                        IN     NUMBER      ,
223     x_last_update_date                  IN     DATE        ,
224     x_last_updated_by                   IN     NUMBER      ,
225     x_last_update_login                 IN     NUMBER
226   ) AS
227   /*
228   ||  Created By : [email protected]
229   ||  Created On : 30-MAY-2002
230   ||  Purpose : Initialises the columns, Checks Constraints, Calls the
231   ||            Trigger Handlers for the table, before any DML operation.
232   ||  Known limitations, enhancements or remarks :
233   ||  Change History :
234   ||  Who             When            What
235   ||  (reverse chronological order - newest change first)
236   */
237       l_path varchar2(150) := g_path||'before_dml';
238   BEGIN
239 
240     set_column_values (
241       p_action,
242       x_rowid,
243       x_projection_id,
244       x_period_counter,
245       x_fiscal_year,
246       x_company,
247       x_cost_center,
248       x_account,
249       x_asset_id,
250       x_latest_reval_cost,
251       x_deprn_period,
252       x_deprn_ytd,
253       x_deprn_reserve,
254       x_asset_exception,
255       x_revaluation_flag,
256       x_creation_date,
257       x_created_by,
258       x_last_update_date,
259       x_last_updated_by,
260       x_last_update_login
261     );
262 
263     IF (p_action = 'INSERT') THEN
264       -- Call all the procedures related to Before Insert.
265       IF ( get_pk_for_validation(
266              new_references.projection_id,
267              new_references.asset_id,
268              new_references.period_counter
269            )
270          ) THEN
271         fnd_message.set_name('FND','FORM_DUPLICATE_KEY_IN_INDEX');
272         igi_iac_debug_pkg.debug_other_msg(g_error_level,l_path,FALSE);
273         app_exception.raise_exception;
274       END IF;
275       check_parent_existance;
276     ELSIF (p_action = 'UPDATE') THEN
277       -- Call all the procedures related to Before Update.
278       check_parent_existance;
279     ELSIF (p_action = 'VALIDATE_INSERT') THEN
280       -- Call all the procedures related to Before Insert.
281       IF ( get_pk_for_validation (
282              new_references.projection_id,
283              new_references.asset_id,
284              new_references.period_counter
285            )
286          ) THEN
287         fnd_message.set_name('FND','FORM_DUPLICATE_KEY_IN_INDEX');
288         igi_iac_debug_pkg.debug_other_msg(g_error_level,l_path,FALSE);
289         app_exception.raise_exception;
290       END IF;
291     END IF;
292 
293   END before_dml;
294 
295 
296   PROCEDURE insert_row (
297     x_rowid                             IN OUT NOCOPY VARCHAR2,
298     x_projection_id                     IN     NUMBER,
299     x_period_counter                    IN     NUMBER,
300     x_fiscal_year                       IN     NUMBER,
301     x_company                           IN     VARCHAR2,
302     x_cost_center                       IN     VARCHAR2,
303     x_account                           IN     VARCHAR2,
304     x_asset_id                          IN     NUMBER,
305     x_latest_reval_cost                 IN     NUMBER,
306     x_deprn_period                      IN     NUMBER,
307     x_deprn_ytd                         IN     NUMBER,
308     x_deprn_reserve                     IN     NUMBER,
309     x_asset_exception                   IN     VARCHAR2,
310     x_revaluation_flag                  IN     VARCHAR2,
311     x_mode                              IN     VARCHAR2
312   ) AS
313   /*
314   ||  Created By : [email protected]
315   ||  Created On : 30-MAY-2002
316   ||  Purpose : Handles the INSERT DML logic for the table.
317   ||  Known limitations, enhancements or remarks :
318   ||  Change History :
319   ||  Who             When            What
320   ||  (reverse chronological order - newest change first)
321   */
322     CURSOR c IS
323       SELECT   rowid
324       FROM     igi_iac_proj_details
325       WHERE    projection_id                     = x_projection_id
326       AND      asset_id                          = x_asset_id
327       AND      period_counter                    = x_period_counter;
328 
329     x_last_update_date           DATE;
330     x_last_updated_by            NUMBER;
331     x_last_update_login          NUMBER;
332     l_path 			 varchar2(150) := g_path||'insert_row';
333   BEGIN
334 
335     x_last_update_date := SYSDATE;
336     IF (x_mode = 'I') THEN
337       x_last_updated_by := 1;
338       x_last_update_login := 0;
339     ELSIF (x_mode = 'R') THEN
340       x_last_updated_by := fnd_global.user_id;
341       IF (x_last_updated_by IS NULL) THEN
342         x_last_updated_by := -1;
343       END IF;
347       END IF;
344       x_last_update_login := fnd_global.login_id;
345       IF (x_last_update_login IS NULL) THEN
346         x_last_update_login := -1;
348     ELSE
349       fnd_message.set_name ('FND', 'SYSTEM-INVALID ARGS');
350       igi_iac_debug_pkg.debug_other_msg(g_error_level,l_path,FALSE);
351       app_exception.raise_exception;
352     END IF;
353 
354     before_dml(
355       p_action                            => 'INSERT',
356       x_rowid                             => x_rowid,
357       x_projection_id                     => x_projection_id,
358       x_period_counter                    => x_period_counter,
359       x_fiscal_year                       => x_fiscal_year,
360       x_company                           => x_company,
361       x_cost_center                       => x_cost_center,
362       x_account                           => x_account,
363       x_asset_id                          => x_asset_id,
364       x_latest_reval_cost                 => x_latest_reval_cost,
365       x_deprn_period                      => x_deprn_period,
366       x_deprn_ytd                         => x_deprn_ytd,
367       x_deprn_reserve                     => x_deprn_reserve,
368       x_asset_exception                   => x_asset_exception,
369       x_revaluation_flag                  => x_revaluation_flag,
370       x_creation_date                     => x_last_update_date,
371       x_created_by                        => x_last_updated_by,
372       x_last_update_date                  => x_last_update_date,
373       x_last_updated_by                   => x_last_updated_by,
374       x_last_update_login                 => x_last_update_login
375     );
376 
377     INSERT INTO igi_iac_proj_details (
378       projection_id,
379       period_counter,
380       fiscal_year,
381       company,
382       cost_center,
383       account,
384       asset_id,
385       latest_reval_cost,
386       deprn_period,
387       deprn_ytd,
388       deprn_reserve,
389       asset_exception,
390       revaluation_flag,
391       creation_date,
392       created_by,
393       last_update_date,
394       last_updated_by,
395       last_update_login
396     ) VALUES (
397       new_references.projection_id,
398       new_references.period_counter,
399       new_references.fiscal_year,
400       new_references.company,
401       new_references.cost_center,
402       new_references.account,
403       new_references.asset_id,
404       new_references.latest_reval_cost,
405       new_references.deprn_period,
406       new_references.deprn_ytd,
407       new_references.deprn_reserve,
408       new_references.asset_exception,
409       new_references.revaluation_flag,
410       x_last_update_date,
411       x_last_updated_by,
412       x_last_update_date,
413       x_last_updated_by,
414       x_last_update_login
415     );
416 
417     OPEN c;
418     FETCH c INTO x_rowid;
419     IF (c%NOTFOUND) THEN
420       CLOSE c;
421       RAISE NO_DATA_FOUND;
422     END IF;
423     CLOSE c;
424 
425   END insert_row;
426 
427 
428   PROCEDURE lock_row (
429     x_rowid                             IN     VARCHAR2,
430     x_projection_id                     IN     NUMBER,
431     x_period_counter                    IN     NUMBER,
432     x_fiscal_year                       IN     NUMBER,
433     x_company                           IN     VARCHAR2,
434     x_cost_center                       IN     VARCHAR2,
435     x_account                           IN     VARCHAR2,
436     x_asset_id                          IN     NUMBER,
437     x_latest_reval_cost                 IN     NUMBER,
438     x_deprn_period                      IN     NUMBER,
439     x_deprn_ytd                         IN     NUMBER,
440     x_deprn_reserve                     IN     NUMBER,
441     x_asset_exception                   IN     VARCHAR2,
442     x_revaluation_flag                  IN     VARCHAR2
443   ) AS
444   /*
445   ||  Created By : [email protected]
446   ||  Created On : 30-MAY-2002
447   ||  Purpose : Handles the LOCK mechanism for the table.
448   ||  Known limitations, enhancements or remarks :
449   ||  Change History :
450   ||  Who             When            What
451   ||  (reverse chronological order - newest change first)
452   */
453     CURSOR c1 IS
454       SELECT
455         fiscal_year,
456         company,
457         cost_center,
458         account,
459         latest_reval_cost,
460         deprn_period,
461         deprn_ytd,
462         deprn_reserve,
463         asset_exception,
464         revaluation_flag
465       FROM  igi_iac_proj_details
466       WHERE rowid = x_rowid
467       FOR UPDATE NOWAIT;
468 
469     tlinfo c1%ROWTYPE;
470     l_path varchar2(150) := g_path||'lock_row';
471   BEGIN
472 
473     OPEN c1;
474     FETCH c1 INTO tlinfo;
475     IF (c1%notfound) THEN
476       fnd_message.set_name('FND', 'FORM_RECORD_DELETED');
477       igi_iac_debug_pkg.debug_other_msg(g_error_level,l_path,FALSE);
478       CLOSE c1;
479       app_exception.raise_exception;
480       RETURN;
481     END IF;
482     CLOSE c1;
483 
484     IF (
485         (tlinfo.fiscal_year = x_fiscal_year)
486         AND (tlinfo.company = x_company)
490         AND ((tlinfo.deprn_period = x_deprn_period) OR ((tlinfo.deprn_period IS NULL) AND (X_deprn_period IS NULL)))
487         AND (tlinfo.cost_center = x_cost_center)
488         AND ((tlinfo.account = x_account) OR ((tlinfo.account IS NULL) AND (X_account IS NULL)))
489         AND ((tlinfo.latest_reval_cost = x_latest_reval_cost) OR ((tlinfo.latest_reval_cost IS NULL) AND (X_latest_reval_cost IS NULL)))
491         AND ((tlinfo.deprn_ytd = x_deprn_ytd) OR ((tlinfo.deprn_ytd IS NULL) AND (X_deprn_ytd IS NULL)))
492         AND ((tlinfo.deprn_reserve = x_deprn_reserve) OR ((tlinfo.deprn_reserve IS NULL) AND (X_deprn_reserve IS NULL)))
493         AND ((tlinfo.asset_exception = x_asset_exception) OR ((tlinfo.asset_exception IS NULL) AND (X_asset_exception IS NULL)))
494         AND ((tlinfo.revaluation_flag = x_revaluation_flag) OR ((tlinfo.revaluation_flag IS NULL) AND (X_revaluation_flag IS NULL)))
495        ) THEN
496       NULL;
497     ELSE
498       fnd_message.set_name('FND', 'FORM_RECORD_CHANGED');
499       igi_iac_debug_pkg.debug_other_msg(g_error_level,l_path,FALSE);
500       app_exception.raise_exception;
501     END IF;
502 
503     RETURN;
504 
505   END lock_row;
506 
507 
508   PROCEDURE update_row (
509     x_rowid                             IN     VARCHAR2,
510     x_projection_id                     IN     NUMBER,
511     x_period_counter                    IN     NUMBER,
512     x_fiscal_year                       IN     NUMBER,
513     x_company                           IN     VARCHAR2,
514     x_cost_center                       IN     VARCHAR2,
515     x_account                           IN     VARCHAR2,
516     x_asset_id                          IN     NUMBER,
517     x_latest_reval_cost                 IN     NUMBER,
518     x_deprn_period                      IN     NUMBER,
519     x_deprn_ytd                         IN     NUMBER,
520     x_deprn_reserve                     IN     NUMBER,
521     x_asset_exception                   IN     VARCHAR2,
522     x_revaluation_flag                  IN     VARCHAR2,
523     x_mode                              IN     VARCHAR2
524   ) AS
525   /*
526   ||  Created By : [email protected]
527   ||  Created On : 30-MAY-2002
528   ||  Purpose : Handles the UPDATE DML logic for the table.
529   ||  Known limitations, enhancements or remarks :
530   ||  Change History :
531   ||  Who             When            What
532   ||  (reverse chronological order - newest change first)
533   */
534     x_last_update_date           DATE ;
535     x_last_updated_by            NUMBER;
536     x_last_update_login          NUMBER;
537     l_path 			 varchar2(150) := g_path||'update_row';
538   BEGIN
539 
540     x_last_update_date := SYSDATE;
541     IF (X_MODE = 'I') THEN
542       x_last_updated_by := 1;
543       x_last_update_login := 0;
544     ELSIF (x_mode = 'R') THEN
545       x_last_updated_by := fnd_global.user_id;
546       IF x_last_updated_by IS NULL THEN
547         x_last_updated_by := -1;
548       END IF;
549       x_last_update_login := fnd_global.login_id;
550       IF (x_last_update_login IS NULL) THEN
551         x_last_update_login := -1;
552       END IF;
553     ELSE
554       fnd_message.set_name( 'FND', 'SYSTEM-INVALID ARGS');
555       igi_iac_debug_pkg.debug_other_msg(g_error_level,l_path,FALSE);
556       app_exception.raise_exception;
557     END IF;
558 
559     before_dml(
560       p_action                            => 'UPDATE',
561       x_rowid                             => x_rowid,
562       x_projection_id                     => x_projection_id,
563       x_period_counter                    => x_period_counter,
564       x_fiscal_year                       => x_fiscal_year,
565       x_company                           => x_company,
566       x_cost_center                       => x_cost_center,
567       x_account                           => x_account,
568       x_asset_id                          => x_asset_id,
569       x_latest_reval_cost                 => x_latest_reval_cost,
570       x_deprn_period                      => x_deprn_period,
571       x_deprn_ytd                         => x_deprn_ytd,
572       x_deprn_reserve                     => x_deprn_reserve,
573       x_asset_exception                   => x_asset_exception,
574       x_revaluation_flag                  => x_revaluation_flag,
575       x_creation_date                     => x_last_update_date,
576       x_created_by                        => x_last_updated_by,
577       x_last_update_date                  => x_last_update_date,
578       x_last_updated_by                   => x_last_updated_by,
579       x_last_update_login                 => x_last_update_login
580     );
581 
582     UPDATE igi_iac_proj_details
583       SET
584         fiscal_year                       = new_references.fiscal_year,
585         company                           = new_references.company,
586         cost_center                       = new_references.cost_center,
587         account                           = new_references.account,
588         latest_reval_cost                 = new_references.latest_reval_cost,
589         deprn_period                      = new_references.deprn_period,
590         deprn_ytd                         = new_references.deprn_ytd,
591         deprn_reserve                     = new_references.deprn_reserve,
592         asset_exception                   = new_references.asset_exception,
593         revaluation_flag                  = new_references.revaluation_flag,
594         last_update_date                  = x_last_update_date,
595         last_updated_by                   = x_last_updated_by,
596         last_update_login                 = x_last_update_login
597       WHERE rowid = x_rowid;
598 
599     IF (SQL%NOTFOUND) THEN
600       RAISE NO_DATA_FOUND;
601     END IF;
602 
603   END update_row;
604 
605 
606   PROCEDURE add_row (
607     x_rowid                             IN OUT NOCOPY VARCHAR2,
608     x_projection_id                     IN     NUMBER,
609     x_period_counter                    IN     NUMBER,
610     x_fiscal_year                       IN     NUMBER,
611     x_company                           IN     VARCHAR2,
612     x_cost_center                       IN     VARCHAR2,
613     x_account                           IN     VARCHAR2,
614     x_asset_id                          IN     NUMBER,
615     x_latest_reval_cost                 IN     NUMBER,
616     x_deprn_period                      IN     NUMBER,
617     x_deprn_ytd                         IN     NUMBER,
618     x_deprn_reserve                     IN     NUMBER,
619     x_asset_exception                   IN     VARCHAR2,
620     x_revaluation_flag                  IN     VARCHAR2,
621     x_mode                              IN     VARCHAR2
622   ) AS
623   /*
624   ||  Created By : [email protected]
625   ||  Created On : 30-MAY-2002
626   ||  Purpose : Adds a row if there is no existing row, otherwise updates existing row in the table.
627   ||  Known limitations, enhancements or remarks :
628   ||  Change History :
629   ||  Who             When            What
630   ||  (reverse chronological order - newest change first)
631   */
632     CURSOR c1 IS
633       SELECT   rowid
634       FROM     igi_iac_proj_details
635       WHERE    projection_id                     = x_projection_id
636       AND      asset_id                          = x_asset_id
637       AND      period_counter                    = x_period_counter;
638   BEGIN
639 
640     OPEN c1;
641     FETCH c1 INTO x_rowid;
642     IF (c1%NOTFOUND) THEN
643       CLOSE c1;
644 
645       insert_row (
646         x_rowid,
647         x_projection_id,
648         x_period_counter,
649         x_fiscal_year,
650         x_company,
651         x_cost_center,
652         x_account,
653         x_asset_id,
654         x_latest_reval_cost,
655         x_deprn_period,
656         x_deprn_ytd,
657         x_deprn_reserve,
658         x_asset_exception,
659         x_revaluation_flag,
660         x_mode
661       );
662       RETURN;
663     END IF;
664     CLOSE c1;
665 
666     update_row (
667       x_rowid,
668       x_projection_id,
669       x_period_counter,
670       x_fiscal_year,
671       x_company,
672       x_cost_center,
673       x_account,
674       x_asset_id,
675       x_latest_reval_cost,
676       x_deprn_period,
677       x_deprn_ytd,
678       x_deprn_reserve,
679       x_asset_exception,
680       x_revaluation_flag,
681       x_mode
682     );
683 
684   END add_row;
685 
686 
687   PROCEDURE delete_row (
688     x_rowid IN VARCHAR2
689   ) AS
690   /*
691   ||  Created By : [email protected]
692   ||  Created On : 30-MAY-2002
693   ||  Purpose : Handles the DELETE DML logic for the table.
694   ||  Known limitations, enhancements or remarks :
695   ||  Change History :
696   ||  Who             When            What
697   ||  (reverse chronological order - newest change first)
698   */
699   BEGIN
700 
701     before_dml (
702       p_action => 'DELETE',
703       x_rowid => x_rowid
704     );
705 
706     DELETE FROM igi_iac_proj_details
707     WHERE rowid = x_rowid;
708 
709     IF (SQL%NOTFOUND) THEN
710       RAISE NO_DATA_FOUND;
711     END IF;
712 
713   END delete_row;
714 
715 
716 END igi_iac_proj_details_pkg;