30: CLOSE check_event_already_exisits;
31: IF l_count = 0 THEN
32: l_ins_flag := 'Y';
33: -- Meaning event data is not present in ERES Processing Table
34: IF p_event_name in ( gme_common_pvt.G_RESOURCE_ADDED
35: ,gme_common_pvt.G_RESOURCE_REMOVED
36: ,gme_common_pvt.G_RESOURCE_UPDATE)
37: THEN
38: select count(*) into l_count
31: IF l_count = 0 THEN
32: l_ins_flag := 'Y';
33: -- Meaning event data is not present in ERES Processing Table
34: IF p_event_name in ( gme_common_pvt.G_RESOURCE_ADDED
35: ,gme_common_pvt.G_RESOURCE_REMOVED
36: ,gme_common_pvt.G_RESOURCE_UPDATE)
37: THEN
38: select count(*) into l_count
39: from GME_ERES_GTMP
32: l_ins_flag := 'Y';
33: -- Meaning event data is not present in ERES Processing Table
34: IF p_event_name in ( gme_common_pvt.G_RESOURCE_ADDED
35: ,gme_common_pvt.G_RESOURCE_REMOVED
36: ,gme_common_pvt.G_RESOURCE_UPDATE)
37: THEN
38: select count(*) into l_count
39: from GME_ERES_GTMP
40: where (event_name = gme_common_pvt.G_BATCHSTEP_ADDED
36: ,gme_common_pvt.G_RESOURCE_UPDATE)
37: THEN
38: select count(*) into l_count
39: from GME_ERES_GTMP
40: where (event_name = gme_common_pvt.G_BATCHSTEP_ADDED
41: and event_key = substrb(P_EVENT_KEY,1,instrb(P_EVENT_KEY,'-',1,2)-1)) OR
42: (event_name = gme_common_pvt.G_ACTIVITY_ADDED
43: and event_key = substrb(P_EVENT_KEY,1,instrb(P_EVENT_KEY,'-',1,3)-1));
44: IF l_count = 0 then
38: select count(*) into l_count
39: from GME_ERES_GTMP
40: where (event_name = gme_common_pvt.G_BATCHSTEP_ADDED
41: and event_key = substrb(P_EVENT_KEY,1,instrb(P_EVENT_KEY,'-',1,2)-1)) OR
42: (event_name = gme_common_pvt.G_ACTIVITY_ADDED
43: and event_key = substrb(P_EVENT_KEY,1,instrb(P_EVENT_KEY,'-',1,3)-1));
44: IF l_count = 0 then
45: select count(*) into l_count
46: from GME_ERES_GTMP
43: and event_key = substrb(P_EVENT_KEY,1,instrb(P_EVENT_KEY,'-',1,3)-1));
44: IF l_count = 0 then
45: select count(*) into l_count
46: from GME_ERES_GTMP
47: where event_name in (gme_common_pvt.G_RESOURCE_ADDED )
48: and event_key = p_event_key;
49: IF (l_count > 0)
50: THEN
51: IF p_event_name = gme_common_pvt.G_RESOURCE_REMOVED THEN
47: where event_name in (gme_common_pvt.G_RESOURCE_ADDED )
48: and event_key = p_event_key;
49: IF (l_count > 0)
50: THEN
51: IF p_event_name = gme_common_pvt.G_RESOURCE_REMOVED THEN
52: delete GME_ERES_GTMP
53: where event_name in (gme_common_pvt.G_RESOURCE_ADDED )
54: and event_key = p_event_key;
55: end if;
49: IF (l_count > 0)
50: THEN
51: IF p_event_name = gme_common_pvt.G_RESOURCE_REMOVED THEN
52: delete GME_ERES_GTMP
53: where event_name in (gme_common_pvt.G_RESOURCE_ADDED )
54: and event_key = p_event_key;
55: end if;
56: l_ins_flag := 'N';
57: ELSE
54: and event_key = p_event_key;
55: end if;
56: l_ins_flag := 'N';
57: ELSE
58: if p_event_name = gme_common_pvt.G_RESOURCE_REMOVED
59: then
60: delete GME_ERES_GTMP
61: where event_name in (gme_common_pvt.G_RESOURCE_UPDATE)
62: and event_key = p_event_key;
57: ELSE
58: if p_event_name = gme_common_pvt.G_RESOURCE_REMOVED
59: then
60: delete GME_ERES_GTMP
61: where event_name in (gme_common_pvt.G_RESOURCE_UPDATE)
62: and event_key = p_event_key;
63: end if;
64: l_ins_flag := 'Y';
65: END IF;
65: END IF;
66: ELSE
67: l_ins_flag := 'N';
68: END IF;
69: ELSIF p_event_name in (gme_common_pvt.G_ACTIVITY_ADDED
70: ,gme_common_pvt.G_ACTIVITY_REMOVED
71: ,gme_common_pvt.G_ACTIVITY_UPDATED)
72: THEN
73: select count(*) into l_count
66: ELSE
67: l_ins_flag := 'N';
68: END IF;
69: ELSIF p_event_name in (gme_common_pvt.G_ACTIVITY_ADDED
70: ,gme_common_pvt.G_ACTIVITY_REMOVED
71: ,gme_common_pvt.G_ACTIVITY_UPDATED)
72: THEN
73: select count(*) into l_count
74: from GME_ERES_GTMP
67: l_ins_flag := 'N';
68: END IF;
69: ELSIF p_event_name in (gme_common_pvt.G_ACTIVITY_ADDED
70: ,gme_common_pvt.G_ACTIVITY_REMOVED
71: ,gme_common_pvt.G_ACTIVITY_UPDATED)
72: THEN
73: select count(*) into l_count
74: from GME_ERES_GTMP
75: where (event_name = gme_common_pvt.G_BATCHSTEP_ADDED
71: ,gme_common_pvt.G_ACTIVITY_UPDATED)
72: THEN
73: select count(*) into l_count
74: from GME_ERES_GTMP
75: where (event_name = gme_common_pvt.G_BATCHSTEP_ADDED
76: and event_key = substrb(P_EVENT_KEY,1,instrb(P_EVENT_KEY,'-',1,2)-1));
77: IF l_count = 0 then
78: select count(*) into l_count
79: from GME_ERES_GTMP
76: and event_key = substrb(P_EVENT_KEY,1,instrb(P_EVENT_KEY,'-',1,2)-1));
77: IF l_count = 0 then
78: select count(*) into l_count
79: from GME_ERES_GTMP
80: where event_name in (gme_common_pvt.G_ACTIVITY_ADDED )
81: and event_key = p_event_key;
82: IF (l_count > 0)
83: THEN
84: IF p_event_name = gme_common_pvt.G_ACTIVITY_REMOVED THEN
80: where event_name in (gme_common_pvt.G_ACTIVITY_ADDED )
81: and event_key = p_event_key;
82: IF (l_count > 0)
83: THEN
84: IF p_event_name = gme_common_pvt.G_ACTIVITY_REMOVED THEN
85: delete GME_ERES_GTMP
86: where event_name in (gme_common_pvt.G_ACTIVITY_ADDED )
87: and event_key = p_event_key;
88: end if;
82: IF (l_count > 0)
83: THEN
84: IF p_event_name = gme_common_pvt.G_ACTIVITY_REMOVED THEN
85: delete GME_ERES_GTMP
86: where event_name in (gme_common_pvt.G_ACTIVITY_ADDED )
87: and event_key = p_event_key;
88: end if;
89: l_ins_flag := 'N';
90: ELSE
87: and event_key = p_event_key;
88: end if;
89: l_ins_flag := 'N';
90: ELSE
91: if p_event_name = gme_common_pvt.G_ACTIVITY_REMOVED
92: then
93: delete GME_ERES_GTMP
94: where (event_name in (gme_common_pvt.G_ACTIVITY_UPDATED)
95: and event_key = p_event_key) OR
90: ELSE
91: if p_event_name = gme_common_pvt.G_ACTIVITY_REMOVED
92: then
93: delete GME_ERES_GTMP
94: where (event_name in (gme_common_pvt.G_ACTIVITY_UPDATED)
95: and event_key = p_event_key) OR
96: (event_name in (gme_common_pvt.G_RESOURCE_ADDED
97: ,gme_common_pvt.G_RESOURCE_REMOVED
98: ,gme_common_pvt.G_RESOURCE_UPDATE)
92: then
93: delete GME_ERES_GTMP
94: where (event_name in (gme_common_pvt.G_ACTIVITY_UPDATED)
95: and event_key = p_event_key) OR
96: (event_name in (gme_common_pvt.G_RESOURCE_ADDED
97: ,gme_common_pvt.G_RESOURCE_REMOVED
98: ,gme_common_pvt.G_RESOURCE_UPDATE)
99: and substrb(EVENT_KEY,1,instrb(EVENT_KEY,'-',1,3)-1) = p_event_key);
100: end if;
93: delete GME_ERES_GTMP
94: where (event_name in (gme_common_pvt.G_ACTIVITY_UPDATED)
95: and event_key = p_event_key) OR
96: (event_name in (gme_common_pvt.G_RESOURCE_ADDED
97: ,gme_common_pvt.G_RESOURCE_REMOVED
98: ,gme_common_pvt.G_RESOURCE_UPDATE)
99: and substrb(EVENT_KEY,1,instrb(EVENT_KEY,'-',1,3)-1) = p_event_key);
100: end if;
101: l_ins_flag := 'Y';
94: where (event_name in (gme_common_pvt.G_ACTIVITY_UPDATED)
95: and event_key = p_event_key) OR
96: (event_name in (gme_common_pvt.G_RESOURCE_ADDED
97: ,gme_common_pvt.G_RESOURCE_REMOVED
98: ,gme_common_pvt.G_RESOURCE_UPDATE)
99: and substrb(EVENT_KEY,1,instrb(EVENT_KEY,'-',1,3)-1) = p_event_key);
100: end if;
101: l_ins_flag := 'Y';
102: END IF;
102: END IF;
103: ELSE
104: l_ins_flag := 'N';
105: END IF;
106: ELSIF p_event_name in (gme_common_pvt.G_BATCHSTEP_ADDED ,
107: gme_common_pvt.G_BATCHSTEP_REMOVED ,
108: gme_common_pvt.G_BATCHSTEP_UPDATE)
109: THEN
110: select count(*) into l_count
103: ELSE
104: l_ins_flag := 'N';
105: END IF;
106: ELSIF p_event_name in (gme_common_pvt.G_BATCHSTEP_ADDED ,
107: gme_common_pvt.G_BATCHSTEP_REMOVED ,
108: gme_common_pvt.G_BATCHSTEP_UPDATE)
109: THEN
110: select count(*) into l_count
111: from GME_ERES_GTMP
104: l_ins_flag := 'N';
105: END IF;
106: ELSIF p_event_name in (gme_common_pvt.G_BATCHSTEP_ADDED ,
107: gme_common_pvt.G_BATCHSTEP_REMOVED ,
108: gme_common_pvt.G_BATCHSTEP_UPDATE)
109: THEN
110: select count(*) into l_count
111: from GME_ERES_GTMP
112: where event_name = gme_common_pvt.G_BATCHSTEP_ADDED
108: gme_common_pvt.G_BATCHSTEP_UPDATE)
109: THEN
110: select count(*) into l_count
111: from GME_ERES_GTMP
112: where event_name = gme_common_pvt.G_BATCHSTEP_ADDED
113: and event_key = p_event_key;
114: IF (l_count > 0)
115: THEN
116: IF p_event_name = gme_common_pvt.G_BATCHSTEP_REMOVED THEN
112: where event_name = gme_common_pvt.G_BATCHSTEP_ADDED
113: and event_key = p_event_key;
114: IF (l_count > 0)
115: THEN
116: IF p_event_name = gme_common_pvt.G_BATCHSTEP_REMOVED THEN
117: delete GME_ERES_GTMP
118: where event_name in (gme_common_pvt.G_BATCHSTEP_ADDED )
119: and event_key = p_event_key;
120: end if;
114: IF (l_count > 0)
115: THEN
116: IF p_event_name = gme_common_pvt.G_BATCHSTEP_REMOVED THEN
117: delete GME_ERES_GTMP
118: where event_name in (gme_common_pvt.G_BATCHSTEP_ADDED )
119: and event_key = p_event_key;
120: end if;
121: l_ins_flag := 'N';
122: ELSE
119: and event_key = p_event_key;
120: end if;
121: l_ins_flag := 'N';
122: ELSE
123: if p_event_name = gme_common_pvt.G_BATCHSTEP_REMOVED
124: then
125: delete GME_ERES_GTMP
126: where (event_name in (gme_common_pvt.G_BATCHSTEP_UPDATE)
127: and event_key = p_event_key) OR
122: ELSE
123: if p_event_name = gme_common_pvt.G_BATCHSTEP_REMOVED
124: then
125: delete GME_ERES_GTMP
126: where (event_name in (gme_common_pvt.G_BATCHSTEP_UPDATE)
127: and event_key = p_event_key) OR
128: (event_name in (gme_common_pvt.G_RESOURCE_ADDED
129: ,gme_common_pvt.G_RESOURCE_REMOVED
130: ,gme_common_pvt.G_RESOURCE_UPDATE
124: then
125: delete GME_ERES_GTMP
126: where (event_name in (gme_common_pvt.G_BATCHSTEP_UPDATE)
127: and event_key = p_event_key) OR
128: (event_name in (gme_common_pvt.G_RESOURCE_ADDED
129: ,gme_common_pvt.G_RESOURCE_REMOVED
130: ,gme_common_pvt.G_RESOURCE_UPDATE
131: ,gme_common_pvt.G_ACTIVITY_ADDED
132: ,gme_common_pvt.G_ACTIVITY_REMOVED
125: delete GME_ERES_GTMP
126: where (event_name in (gme_common_pvt.G_BATCHSTEP_UPDATE)
127: and event_key = p_event_key) OR
128: (event_name in (gme_common_pvt.G_RESOURCE_ADDED
129: ,gme_common_pvt.G_RESOURCE_REMOVED
130: ,gme_common_pvt.G_RESOURCE_UPDATE
131: ,gme_common_pvt.G_ACTIVITY_ADDED
132: ,gme_common_pvt.G_ACTIVITY_REMOVED
133: ,gme_common_pvt.G_ACTIVITY_UPDATED)
126: where (event_name in (gme_common_pvt.G_BATCHSTEP_UPDATE)
127: and event_key = p_event_key) OR
128: (event_name in (gme_common_pvt.G_RESOURCE_ADDED
129: ,gme_common_pvt.G_RESOURCE_REMOVED
130: ,gme_common_pvt.G_RESOURCE_UPDATE
131: ,gme_common_pvt.G_ACTIVITY_ADDED
132: ,gme_common_pvt.G_ACTIVITY_REMOVED
133: ,gme_common_pvt.G_ACTIVITY_UPDATED)
134: and substrb(EVENT_KEY,1,instrb(EVENT_KEY,'-',1,2)-1) = p_event_key);
127: and event_key = p_event_key) OR
128: (event_name in (gme_common_pvt.G_RESOURCE_ADDED
129: ,gme_common_pvt.G_RESOURCE_REMOVED
130: ,gme_common_pvt.G_RESOURCE_UPDATE
131: ,gme_common_pvt.G_ACTIVITY_ADDED
132: ,gme_common_pvt.G_ACTIVITY_REMOVED
133: ,gme_common_pvt.G_ACTIVITY_UPDATED)
134: and substrb(EVENT_KEY,1,instrb(EVENT_KEY,'-',1,2)-1) = p_event_key);
135: end if;
128: (event_name in (gme_common_pvt.G_RESOURCE_ADDED
129: ,gme_common_pvt.G_RESOURCE_REMOVED
130: ,gme_common_pvt.G_RESOURCE_UPDATE
131: ,gme_common_pvt.G_ACTIVITY_ADDED
132: ,gme_common_pvt.G_ACTIVITY_REMOVED
133: ,gme_common_pvt.G_ACTIVITY_UPDATED)
134: and substrb(EVENT_KEY,1,instrb(EVENT_KEY,'-',1,2)-1) = p_event_key);
135: end if;
136: l_ins_flag := 'Y';
129: ,gme_common_pvt.G_RESOURCE_REMOVED
130: ,gme_common_pvt.G_RESOURCE_UPDATE
131: ,gme_common_pvt.G_ACTIVITY_ADDED
132: ,gme_common_pvt.G_ACTIVITY_REMOVED
133: ,gme_common_pvt.G_ACTIVITY_UPDATED)
134: and substrb(EVENT_KEY,1,instrb(EVENT_KEY,'-',1,2)-1) = p_event_key);
135: end if;
136: l_ins_flag := 'Y';
137: END IF;
135: end if;
136: l_ins_flag := 'Y';
137: END IF;
138: END IF;
139: IF p_event_name in ( gme_common_pvt.G_BATCHMTL_ADDED
140: ,gme_common_pvt.G_BATCHMTL_REMOVED
141: ,gme_common_pvt.G_BATCHMTL_UPDATED)
142: THEN
143:
136: l_ins_flag := 'Y';
137: END IF;
138: END IF;
139: IF p_event_name in ( gme_common_pvt.G_BATCHMTL_ADDED
140: ,gme_common_pvt.G_BATCHMTL_REMOVED
141: ,gme_common_pvt.G_BATCHMTL_UPDATED)
142: THEN
143:
144: select count(*) into l_count
137: END IF;
138: END IF;
139: IF p_event_name in ( gme_common_pvt.G_BATCHMTL_ADDED
140: ,gme_common_pvt.G_BATCHMTL_REMOVED
141: ,gme_common_pvt.G_BATCHMTL_UPDATED)
142: THEN
143:
144: select count(*) into l_count
145: from GME_ERES_GTMP
142: THEN
143:
144: select count(*) into l_count
145: from GME_ERES_GTMP
146: where event_name = gme_common_pvt.G_BATCHMTL_ADDED
147: and event_key = p_event_key;
148: IF (l_count > 0)
149: THEN
150: IF p_event_name = gme_common_pvt.G_BATCHMTL_REMOVED THEN
146: where event_name = gme_common_pvt.G_BATCHMTL_ADDED
147: and event_key = p_event_key;
148: IF (l_count > 0)
149: THEN
150: IF p_event_name = gme_common_pvt.G_BATCHMTL_REMOVED THEN
151: delete GME_ERES_GTMP
152: where event_name in (gme_common_pvt.G_BATCHMTL_ADDED)
153: and event_key = p_event_key;
154: end if;
148: IF (l_count > 0)
149: THEN
150: IF p_event_name = gme_common_pvt.G_BATCHMTL_REMOVED THEN
151: delete GME_ERES_GTMP
152: where event_name in (gme_common_pvt.G_BATCHMTL_ADDED)
153: and event_key = p_event_key;
154: end if;
155: l_ins_flag := 'N';
156: ELSE
153: and event_key = p_event_key;
154: end if;
155: l_ins_flag := 'N';
156: ELSE
157: if p_event_name = gme_common_pvt.G_BATCHMTL_REMOVED
158: then
159: delete GME_ERES_GTMP
160: where (event_name in (gme_common_pvt.G_BATCHMTL_UPDATED)
161: and event_key = p_event_key);
156: ELSE
157: if p_event_name = gme_common_pvt.G_BATCHMTL_REMOVED
158: then
159: delete GME_ERES_GTMP
160: where (event_name in (gme_common_pvt.G_BATCHMTL_UPDATED)
161: and event_key = p_event_key);
162: end if;
163: l_ins_flag := 'Y';
164: END IF;
166: ELSE
167: l_ins_flag := 'N';
168: END IF;
169: IF l_ins_flag = 'Y' THEN
170: IF p_event_name in ( gme_common_pvt.G_RESOURCE_REMOVED
171: ,gme_common_pvt.G_BATCHMTL_REMOVED
172: ,gme_common_pvt.G_ACTIVITY_REMOVED
173: ,gme_common_pvt.G_BATCHSTEP_REMOVED )
174: THEN
167: l_ins_flag := 'N';
168: END IF;
169: IF l_ins_flag = 'Y' THEN
170: IF p_event_name in ( gme_common_pvt.G_RESOURCE_REMOVED
171: ,gme_common_pvt.G_BATCHMTL_REMOVED
172: ,gme_common_pvt.G_ACTIVITY_REMOVED
173: ,gme_common_pvt.G_BATCHSTEP_REMOVED )
174: THEN
175: l_XML_GEN_API := ' GME_ERES_PKG.GET_EVENT_XML('||''''||p_event_name||''','''||P_EVENT_KEY||''''||')';
168: END IF;
169: IF l_ins_flag = 'Y' THEN
170: IF p_event_name in ( gme_common_pvt.G_RESOURCE_REMOVED
171: ,gme_common_pvt.G_BATCHMTL_REMOVED
172: ,gme_common_pvt.G_ACTIVITY_REMOVED
173: ,gme_common_pvt.G_BATCHSTEP_REMOVED )
174: THEN
175: l_XML_GEN_API := ' GME_ERES_PKG.GET_EVENT_XML('||''''||p_event_name||''','''||P_EVENT_KEY||''''||')';
176: ELSE
169: IF l_ins_flag = 'Y' THEN
170: IF p_event_name in ( gme_common_pvt.G_RESOURCE_REMOVED
171: ,gme_common_pvt.G_BATCHMTL_REMOVED
172: ,gme_common_pvt.G_ACTIVITY_REMOVED
173: ,gme_common_pvt.G_BATCHSTEP_REMOVED )
174: THEN
175: l_XML_GEN_API := ' GME_ERES_PKG.GET_EVENT_XML('||''''||p_event_name||''','''||P_EVENT_KEY||''''||')';
176: ELSE
177: l_XML_GEN_API := null;