1 PACKAGE BODY IGS_GE_INS_SLE AS
2 /* $Header: IGSGE05B.pls 115.4 2002/11/29 00:32:03 nsidana ship $ */
3
4 l_rowid varchar2(25);
5 --
6 -- Insert into IGS_GE_S_LOG_ENTRY from a pl/sql table.
7 PROCEDURE GENP_INS_SLE(
8 p_creation_dt IN OUT NOCOPY DATE )
9 AS
10 gv_other_detail VARCHAR2(255);
11 l_rowid VARCHAR2(25);
12
13 BEGIN -- genp_ins_sle
14 -- This module will read IGS_GE_S_LOG_ENTRY records from a pl/sql table and
15 -- insert them into the IGS_GE_S_LOG_ENTRY table. If it is possible that the
16 -- pl/sql table may be populated with differing IGS_GE_S_LOG_ENTRY types within
17 -- the same transaction, this module will check if the creation date
18 -- parameter is set and will use this. If the creation date parameter
19 -- is null, then it will create an IGS_GE_S_LOG record and the returned
20 -- creation date will be used. If no parent is found, due to differing
21 -- s_log_type, then the procedure will create the IGS_GE_S_LOG record using the
22 -- same creation date that has been used previously.
23 DECLARE
24 e_no_parent_rec_exception EXCEPTION;
25 PRAGMA EXCEPTION_INIT(e_no_parent_rec_exception, -2291);
26 BEGIN
27 -- Loop though the pl/sql table
28 FOR i IN 1..gv_cntr LOOP
29 r_log_entry := t_log_entry(i);
30 BEGIN
31 -- check that the creation date has been determined
32 IF (p_creation_dt IS NULL) THEN
33 -- This will only be called once as p_creation_dt
34 -- will be set after the call.
35 IGS_GE_GEN_003.GENP_INS_LOG(
36 r_log_entry.s_log_type,
37 r_log_entry.sl_key,
38 p_creation_dt);
39 END IF;
40 IGS_GE_GEN_003.GENP_INS_LOG_ENTRY(
41 r_log_entry.s_log_type,
42 p_creation_dt,
43 r_log_entry.sle_key,
44 r_log_entry.sle_message_name,
45 r_log_entry.text);
46 EXCEPTION
47 WHEN e_no_parent_rec_exception THEN
48 -- This exception can arrise when there is a change in s_log_type
49 -- that has been used during the population of the pl/sql table.
50 -- Insert the IGS_GE_S_LOG record using the same creation date.
51 IGS_GE_S_LOG_PKG.INSERT_ROW(
52 x_rowid => l_rowid ,
53 x_s_log_type => r_log_entry.s_log_type,
54 x_creation_dt => p_creation_dt,
55 x_key =>r_log_entry.sl_key ,
56 x_mode => 'R' );
57 IGS_GE_GEN_003.GENP_INS_LOG_ENTRY(
58 r_log_entry.s_log_type,
59 p_creation_dt,
60 r_log_entry.sle_key,
61 r_log_entry.sle_message_name,
62 r_log_entry.text);
63 WHEN OTHERS THEN
64 RAISE;
65 END;
66 END LOOP;
67 EXCEPTION
68 WHEN NO_DATA_FOUND THEN
69 -- Reset the counter to 1
70 genp_set_log_cntr;
71 END;
72 EXCEPTION
73 WHEN OTHERS THEN
74 Fnd_Message.Set_Name('IGS' , 'IGS_GE_UNHANDLED_EXCEPTION');
75 IGS_GE_MSG_STACK.ADD;
76 App_Exception.Raise_Exception ;
77 END genp_ins_sle;
78 --
79 -- To insert entry into PL/SQL table to allow log entries after rollback
80 PROCEDURE GENP_SET_LOG_ENTRY(
81 p_s_log_type IN VARCHAR2 ,
82 p_sl_key IN VARCHAR2 ,
83 p_sle_key IN VARCHAR2 ,
84 p_sle_message_name IN VARCHAR2 ,
85 p_text IN VARCHAR2 )
86 AS
87 gv_other_detail VARCHAR2(255);
88 BEGIN -- genp_set_log_entry
89 -- This module will store IGS_GE_S_LOG_ENTRY records in a pl/sql table
90 -- until they are required to be inserted into the IGS_GE_S_LOG_ENTRY table.
91 DECLARE
92 BEGIN
93 r_log_entry.s_log_type := p_s_log_type;
94 r_log_entry.sl_key := p_sl_key;
95 r_log_entry.sle_key := p_sle_key;
96 r_log_entry.sle_message_name := p_sle_message_name;
97 r_log_entry.text := p_text;
98 t_log_entry(gv_cntr) := r_log_entry;
99 gv_cntr := gv_cntr + 1;
100 END;
101 EXCEPTION
102 WHEN OTHERS THEN
103 Fnd_Message.Set_Name('IGS' , 'IGS_GE_UNHANDLED_EXCEPTION');
104 IGS_GE_MSG_STACK.ADD;
105 App_Exception.Raise_Exception ;
106 END genp_set_log_entry;
107 --
108 -- Initialise pl/sql table when creating IGS_GE_S_LOG_ENTRY records.
109 PROCEDURE GENP_SET_LOG_CNTR
110 AS
111 gv_other_detail VARCHAR2(255);
112 BEGIN -- genp_set_log_cntr
113 -- This procedure is called to initialise the gv_cntr to 1
114 -- and to clear the pl/sql table. This is needed when the
115 -- package is used more than once within the same session.
116 DECLARE
117 BEGIN
118 gv_cntr := 1;
119 t_log_entry := t_log_entry_blank;
120 END;
121 EXCEPTION
122 WHEN OTHERS THEN
123 Fnd_Message.Set_Name('IGS' , 'IGS_GE_UNHANDLED_EXCEPTION');
124 IGS_GE_MSG_STACK.ADD;
125 App_Exception.Raise_Exception ;
126 END genp_set_log_cntr;
127 END IGS_GE_INS_SLE;