57: xShot varchar2(2000) := 'SnapShot('||pMode||')['||pIndex||']--';
58: BEGIN
59: IF (pMode = 'CLASS') THEN
60: xShot := xShot || ' gRtCategoryIds: ' ||
61: ICX_POR_EXT_UTL.getTableElement(gRtCategoryIds, pIndex) || ',';
62: xShot := xShot || ' gCategoryKeys: ' ||
63: ICX_POR_EXT_UTL.getTableElement(gCategoryKeys, pIndex) || ',';
64: xShot := xShot || ' gCategoryTypes: ' ||
65: ICX_POR_EXT_UTL.getTableElement(gCategoryTypes, pIndex);
59: IF (pMode = 'CLASS') THEN
60: xShot := xShot || ' gRtCategoryIds: ' ||
61: ICX_POR_EXT_UTL.getTableElement(gRtCategoryIds, pIndex) || ',';
62: xShot := xShot || ' gCategoryKeys: ' ||
63: ICX_POR_EXT_UTL.getTableElement(gCategoryKeys, pIndex) || ',';
64: xShot := xShot || ' gCategoryTypes: ' ||
65: ICX_POR_EXT_UTL.getTableElement(gCategoryTypes, pIndex);
66: ELSIF (pMode = 'ITEM') THEN
67: xShot := xShot || ' gRtItemIds: ' ||
61: ICX_POR_EXT_UTL.getTableElement(gRtCategoryIds, pIndex) || ',';
62: xShot := xShot || ' gCategoryKeys: ' ||
63: ICX_POR_EXT_UTL.getTableElement(gCategoryKeys, pIndex) || ',';
64: xShot := xShot || ' gCategoryTypes: ' ||
65: ICX_POR_EXT_UTL.getTableElement(gCategoryTypes, pIndex);
66: ELSIF (pMode = 'ITEM') THEN
67: xShot := xShot || ' gRtItemIds: ' ||
68: ICX_POR_EXT_UTL.getTableElement(gRtItemIds, pIndex);
69: END IF;
64: xShot := xShot || ' gCategoryTypes: ' ||
65: ICX_POR_EXT_UTL.getTableElement(gCategoryTypes, pIndex);
66: ELSIF (pMode = 'ITEM') THEN
67: xShot := xShot || ' gRtItemIds: ' ||
68: ICX_POR_EXT_UTL.getTableElement(gRtItemIds, pIndex);
69: END IF;
70:
71: RETURN xShot;
72: END snapShot;
91: IF (gCategoryKeys.COUNT = 0) THEN
92: RETURN;
93: END IF;
94:
95: IF (ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.DETIL_LEVEL) THEN
96: FOR i in 1..gCategoryKeys.COUNT LOOP
97: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.DETIL_LEVEL,
98: snapShot(i, 'CLASS'));
99: END LOOP;
93: END IF;
94:
95: IF (ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.DETIL_LEVEL) THEN
96: FOR i in 1..gCategoryKeys.COUNT LOOP
97: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.DETIL_LEVEL,
98: snapShot(i, 'CLASS'));
99: END LOOP;
100: END IF;
101:
99: END LOOP;
100: END IF;
101:
102: xErrLoc := 100;
103: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
104: ICX_POR_EXT_UTL.debug('Delete from ICX_POR_CATEGORY_DATA_SOURCES');
105: END IF;
106: FORALL i IN 1..gCategoryKeys.COUNT
107: DELETE FROM icx_por_category_data_sources
100: END IF;
101:
102: xErrLoc := 100;
103: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
104: ICX_POR_EXT_UTL.debug('Delete from ICX_POR_CATEGORY_DATA_SOURCES');
105: END IF;
106: FORALL i IN 1..gCategoryKeys.COUNT
107: DELETE FROM icx_por_category_data_sources
108: WHERE category_key = gCategoryKeys(i)
107: DELETE FROM icx_por_category_data_sources
108: WHERE category_key = gCategoryKeys(i)
109: AND external_source = 'Oracle';
110:
111: ICX_POR_EXT_UTL.extCommit;
112:
113: xErrLoc := 200;
114: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
115: ICX_POR_EXT_UTL.debug('Delete from ICX_POR_CATEGORY_ORDER_MAP');
110:
111: ICX_POR_EXT_UTL.extCommit;
112:
113: xErrLoc := 200;
114: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
115: ICX_POR_EXT_UTL.debug('Delete from ICX_POR_CATEGORY_ORDER_MAP');
116: END IF;
117: FORALL i IN 1..gRtCategoryIds.COUNT
118: DELETE FROM icx_por_category_order_map
111: ICX_POR_EXT_UTL.extCommit;
112:
113: xErrLoc := 200;
114: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
115: ICX_POR_EXT_UTL.debug('Delete from ICX_POR_CATEGORY_ORDER_MAP');
116: END IF;
117: FORALL i IN 1..gRtCategoryIds.COUNT
118: DELETE FROM icx_por_category_order_map
119: WHERE rt_category_id = gRtCategoryIds(i)
118: DELETE FROM icx_por_category_order_map
119: WHERE rt_category_id = gRtCategoryIds(i)
120: AND external_source = 'Oracle';
121:
122: ICX_POR_EXT_UTL.extCommit;
123:
124: xErrLoc := 300;
125: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
126: ICX_POR_EXT_UTL.debug('Delete from ICX_POR_TABLE_OF_CONTENTS_TL');
121:
122: ICX_POR_EXT_UTL.extCommit;
123:
124: xErrLoc := 300;
125: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
126: ICX_POR_EXT_UTL.debug('Delete from ICX_POR_TABLE_OF_CONTENTS_TL');
127: END IF;
128: FORALL i IN 1..gRtCategoryIds.COUNT
129: DELETE FROM icx_por_table_of_contents_tl
122: ICX_POR_EXT_UTL.extCommit;
123:
124: xErrLoc := 300;
125: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
126: ICX_POR_EXT_UTL.debug('Delete from ICX_POR_TABLE_OF_CONTENTS_TL');
127: END IF;
128: FORALL i IN 1..gRtCategoryIds.COUNT
129: DELETE FROM icx_por_table_of_contents_tl
130: WHERE child = gRtCategoryIds(i);
128: FORALL i IN 1..gRtCategoryIds.COUNT
129: DELETE FROM icx_por_table_of_contents_tl
130: WHERE child = gRtCategoryIds(i);
131:
132: ICX_POR_EXT_UTL.extCommit;
133:
134: xErrLoc := 400;
135: FOR i IN 1..gRtCategoryIds.COUNT LOOP
136:
143:
144: xErrLoc := 430;
145: FETCH cCatItems
146: BULK COLLECT INTO xRtItemIds
147: LIMIT ICX_POR_EXT_UTL.gCommitSize;
148: EXIT WHEN xRtItemIds.COUNT = 0;
149:
150: -- For Category, need also delete all assoicated item records
151: -- For Template Header, only delete that category_item association
151: -- For Template Header, only delete that category_item association
152: IF (gCategoryTypes(i) = ICX_POR_EXT_CLASS.CATEGORY_TYPE) THEN
153:
154: xErrLoc := 440;
155: ICX_POR_DELETE_CATALOG.setCommitSize(ICX_POR_EXT_UTL.gCommitSize);
156: xErrLoc := 445;
157: ICX_POR_DELETE_CATALOG.deleteCommonTables(xRtItemIds,
158: ICX_POR_DELETE_CATALOG.CATITEM_TABLE_LAST);
159:
159:
160: ELSIF (gCategoryTypes(i) = ICX_POR_EXT_CLASS.TEMPLATE_HEADER_TYPE) THEN
161:
162: xErrLoc := 450;
163: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
164: ICX_POR_EXT_UTL.debug('Delete from ICX_CAT_CATEGORY_ITEMS');
165: END IF;
166: FORALL j IN 1..xRtItemIds.COUNT
167: DELETE FROM icx_cat_category_items
160: ELSIF (gCategoryTypes(i) = ICX_POR_EXT_CLASS.TEMPLATE_HEADER_TYPE) THEN
161:
162: xErrLoc := 450;
163: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
164: ICX_POR_EXT_UTL.debug('Delete from ICX_CAT_CATEGORY_ITEMS');
165: END IF;
166: FORALL j IN 1..xRtItemIds.COUNT
167: DELETE FROM icx_cat_category_items
168: WHERE rt_item_id = xRtItemIds(j)
170:
171: END IF;
172:
173: xErrLoc := 460;
174: ICX_POR_EXT_UTL.extCommit;
175:
176: END LOOP;
177:
178: xErrLoc := 480;
180:
181: END LOOP;
182:
183: xErrLoc := 500;
184: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
185: ICX_POR_EXT_UTL.debug('Delete from ICX_CAT_CATEGORIES_TL');
186: END IF;
187: FORALL i IN 1..gRtCategoryIds.COUNT
188: DELETE FROM icx_cat_categories_tl
181: END LOOP;
182:
183: xErrLoc := 500;
184: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
185: ICX_POR_EXT_UTL.debug('Delete from ICX_CAT_CATEGORIES_TL');
186: END IF;
187: FORALL i IN 1..gRtCategoryIds.COUNT
188: DELETE FROM icx_cat_categories_tl
189: WHERE rt_category_id = gRtCategoryIds(i);
188: DELETE FROM icx_cat_categories_tl
189: WHERE rt_category_id = gRtCategoryIds(i);
190:
191: xErrLoc := 600;
192: ICX_POR_EXT_UTL.extAFCommit;
193:
194: xErrLoc := 700;
195: clearTables('CLASS');
196: EXCEPTION
194: xErrLoc := 700;
195: clearTables('CLASS');
196: EXCEPTION
197: when others then
198: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.deleteCategories-'||
199: xErrLoc||' '||SQLERRM);
200: ICX_POR_EXT_UTL.pushError(snapShot(SQL%ROWCOUNT+1, 'CLASS'));
201:
202: ICX_POR_EXT_UTL.extRollback;
196: EXCEPTION
197: when others then
198: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.deleteCategories-'||
199: xErrLoc||' '||SQLERRM);
200: ICX_POR_EXT_UTL.pushError(snapShot(SQL%ROWCOUNT+1, 'CLASS'));
201:
202: ICX_POR_EXT_UTL.extRollback;
203:
204: IF (cCatItems%ISOPEN) THEN
198: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.deleteCategories-'||
199: xErrLoc||' '||SQLERRM);
200: ICX_POR_EXT_UTL.pushError(snapShot(SQL%ROWCOUNT+1, 'CLASS'));
201:
202: ICX_POR_EXT_UTL.extRollback;
203:
204: IF (cCatItems%ISOPEN) THEN
205: CLOSE cCatItems;
206: END IF;
204: IF (cCatItems%ISOPEN) THEN
205: CLOSE cCatItems;
206: END IF;
207:
208: raise ICX_POR_EXT_UTL.gException;
209: END deleteCategories;
210:
211: -- Delete Items
212: procedure deleteItems IS
217: IF (gRtItemIds.COUNT = 0) THEN
218: RETURN;
219: END IF;
220:
221: if (ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.DETIL_LEVEL) then
222: FOR i in 1..gRtItemIds.COUNT LOOP
223: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.DETIL_LEVEL,
224: snapShot(i, 'ITEM'));
225: END LOOP;
219: END IF;
220:
221: if (ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.DETIL_LEVEL) then
222: FOR i in 1..gRtItemIds.COUNT LOOP
223: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.DETIL_LEVEL,
224: snapShot(i, 'ITEM'));
225: END LOOP;
226: end if;
227:
225: END LOOP;
226: end if;
227:
228: xErrLoc := 200;
229: ICX_POR_DELETE_CATALOG.setCommitSize(ICX_POR_EXT_UTL.gCommitSize);
230:
231: xErrLoc := 300;
232: ICX_POR_DELETE_CATALOG.deleteCommonTables(gRtItemIds,
233: ICX_POR_DELETE_CATALOG.ITEM_TABLE_LAST);
235: xErrLoc := 500;
236: clearTables('ITEM');
237: exception
238: when others then
239: ICX_POR_EXT_UTL.extRollback;
240:
241: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.deleteItems-'||
242: xErrLoc||' '||SQLERRM);
243:
237: exception
238: when others then
239: ICX_POR_EXT_UTL.extRollback;
240:
241: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.deleteItems-'||
242: xErrLoc||' '||SQLERRM);
243:
244: raise ICX_POR_EXT_UTL.gException;
245: end deleteItems;
240:
241: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.deleteItems-'||
242: xErrLoc||' '||SQLERRM);
243:
244: raise ICX_POR_EXT_UTL.gException;
245: end deleteItems;
246:
247: -- Process batch data
248: PROCEDURE processBatchData(pType IN VARCHAR2,
254: xErrLoc := 100;
255:
256: IF (pType = 'CLASS' AND
257: (pMode = 'OUTLOOP' OR
258: gRtCategoryIds.COUNT >= ICX_POR_EXT_UTL.gCommitSize))
259: THEN
260: xErrLoc := 200;
261: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
262: 'Process batch category purge -- Pending[' ||
257: (pMode = 'OUTLOOP' OR
258: gRtCategoryIds.COUNT >= ICX_POR_EXT_UTL.gCommitSize))
259: THEN
260: xErrLoc := 200;
261: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
262: 'Process batch category purge -- Pending[' ||
263: gRtCategoryIds.COUNT || '], Completed[' || gCompletedCount || ']');
264:
265: gCompletedCount := gCompletedCount + gRtCategoryIds.COUNT;
268:
269: xErrLoc := 300;
270: IF (pType = 'ITEM' AND
271: (pMode = 'OUTLOOP' OR
272: gRtItemIds.COUNT >= ICX_POR_EXT_UTL.gCommitSize))
273: THEN
274: xErrLoc := 400;
275: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
276: 'Process batch item purge -- Pending[' ||
271: (pMode = 'OUTLOOP' OR
272: gRtItemIds.COUNT >= ICX_POR_EXT_UTL.gCommitSize))
273: THEN
274: xErrLoc := 400;
275: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
276: 'Process batch item purge -- Pending[' ||
277: gRtItemIds.COUNT || '], Completed[' || gCompletedCount || ']');
278:
279: gCompletedCount := gCompletedCount + gRtItemIds.COUNT;
283: xErrLoc := 500;
284: EXCEPTION
285: when OTHERS then
286: -- rollback;
287: ICX_POR_EXT_UTL.extRollback;
288:
289: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.processBatchData-'||
290: xErrLoc||' '||SQLERRM);
291: raise ICX_POR_EXT_UTL.gException;
285: when OTHERS then
286: -- rollback;
287: ICX_POR_EXT_UTL.extRollback;
288:
289: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.processBatchData-'||
290: xErrLoc||' '||SQLERRM);
291: raise ICX_POR_EXT_UTL.gException;
292: END processBatchData;
293:
287: ICX_POR_EXT_UTL.extRollback;
288:
289: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.processBatchData-'||
290: xErrLoc||' '||SQLERRM);
291: raise ICX_POR_EXT_UTL.gException;
292: END processBatchData;
293:
294: --------------------------------------------------------------
295: -- Purge Classfication Data --
319: xStructureId
320: FROM mtl_default_sets_view
321: WHERE functional_area_id = 2;
322:
323: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
324: 'Category Set Information[category_set_id: ' || xCategorySetId ||
325: ', validate_flag: ' || xValidateFlag ||
326: ', structure_id: ' || xStructureId || ']');
327:
388: 'AND cat.last_updated_by = '||ICX_POR_EXT_TEST.TEST_USER_ID;
389: END IF;
390:
391: xErrLoc := 270;
392: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
393: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.INFO_LEVEL,
394: 'Query for category purge: ' || xString);
395: END IF;
396:
389: END IF;
390:
391: xErrLoc := 270;
392: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
393: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.INFO_LEVEL,
394: 'Query for category purge: ' || xString);
395: END IF;
396:
397: IF xValidateFlag = 'Y' THEN
434:
435: xErrLoc := 500;
436: EXCEPTION
437: when others then
438: ICX_POR_EXT_UTL.extRollback;
439:
440: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.openClassCursor-'||
441: xErrLoc||' '||SQLERRM);
442: raise ICX_POR_EXT_UTL.gException;
436: EXCEPTION
437: when others then
438: ICX_POR_EXT_UTL.extRollback;
439:
440: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.openClassCursor-'||
441: xErrLoc||' '||SQLERRM);
442: raise ICX_POR_EXT_UTL.gException;
443: END openClassCursor;
444:
438: ICX_POR_EXT_UTL.extRollback;
439:
440: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.openClassCursor-'||
441: xErrLoc||' '||SQLERRM);
442: raise ICX_POR_EXT_UTL.gException;
443: END openClassCursor;
444:
445: -- Main procedure to purge classification data
446: PROCEDURE purgeClassificationData(pMode IN PLS_INTEGER,
459: BEGIN
460: xErrLoc := 100;
461: gCompletedCount := 0;
462:
463: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
464: 'Purge oracle classification data');
465:
466: xErrLoc := 120;
467: openClassCursor(pMode, pInvCatId, cClass);
476: xRtCategoryIds.DELETE;
477: xKeys.DELETE;
478: xTypes.DELETE;
479:
480: IF (ICX_POR_EXT_UTL.getDatabaseVersion < 9.0) THEN
481: xErrLoc := 150;
482: EXIT WHEN cClass%NOTFOUND;
483: -- Oracle 8i doesn't support BULK Collect from dynamic SQL
484: FOR i IN 1..ICX_POR_EXT_UTL.gCommitSize LOOP
480: IF (ICX_POR_EXT_UTL.getDatabaseVersion < 9.0) THEN
481: xErrLoc := 150;
482: EXIT WHEN cClass%NOTFOUND;
483: -- Oracle 8i doesn't support BULK Collect from dynamic SQL
484: FOR i IN 1..ICX_POR_EXT_UTL.gCommitSize LOOP
485: FETCH cClass
486: INTO xRtCategoryIds(i), xKeys(i), xTypes(i);
487: EXIT WHEN cClass%NOTFOUND;
488: END LOOP;
489: ELSE
490: xErrLoc := 200;
491: FETCH cClass
492: BULK COLLECT INTO xRtCategoryIds, xKeys, xTypes
493: LIMIT ICX_POR_EXT_UTL.gCommitSize;
494: EXIT WHEN xRtCategoryIds.COUNT = 0;
495: END IF;
496:
497: xErrLoc := 240;
495: END IF;
496:
497: xErrLoc := 240;
498: FOR i IN 1..xRtCategoryIds.COUNT LOOP
499: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.DEBUG_LEVEL THEN
500: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.DEBUG_LEVEL,
501: 'Classification[rt_category_id: '|| xRtCategoryIds(i) ||
502: ', key: '|| xKeys(i) || ', type: '|| xTypes(i) ||']');
503: END IF;
496:
497: xErrLoc := 240;
498: FOR i IN 1..xRtCategoryIds.COUNT LOOP
499: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.DEBUG_LEVEL THEN
500: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.DEBUG_LEVEL,
501: 'Classification[rt_category_id: '|| xRtCategoryIds(i) ||
502: ', key: '|| xKeys(i) || ', type: '|| xTypes(i) ||']');
503: END IF;
504:
519: xErrLoc := 600;
520: -- process remaining
521: processBatchData('CLASS', 'OUTLOOP');
522:
523: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
524: 'Total deleted categories: ' || gCompletedCount);
525:
526: xErrLoc := 700;
527: CLOSE cClass;
530: gRestartTime := 0;
531: gExceptionOccured := false;
532:
533: EXCEPTION
534: when ICX_POR_EXT_UTL.gException then
535: -- rollback;
536: ICX_POR_EXT_UTL.extRollback;
537:
538: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.purgeClassificationData-'||
532:
533: EXCEPTION
534: when ICX_POR_EXT_UTL.gException then
535: -- rollback;
536: ICX_POR_EXT_UTL.extRollback;
537:
538: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.purgeClassificationData-'||
539: xErrLoc);
540: raise ICX_POR_EXT_UTL.gException;
534: when ICX_POR_EXT_UTL.gException then
535: -- rollback;
536: ICX_POR_EXT_UTL.extRollback;
537:
538: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.purgeClassificationData-'||
539: xErrLoc);
540: raise ICX_POR_EXT_UTL.gException;
541: when others then
542: -- rollback;
536: ICX_POR_EXT_UTL.extRollback;
537:
538: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.purgeClassificationData-'||
539: xErrLoc);
540: raise ICX_POR_EXT_UTL.gException;
541: when others then
542: -- rollback;
543: ICX_POR_EXT_UTL.extRollback;
544:
539: xErrLoc);
540: raise ICX_POR_EXT_UTL.gException;
541: when others then
542: -- rollback;
543: ICX_POR_EXT_UTL.extRollback;
544:
545: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.purgeClassificationData-'||
546: xErrLoc||' '||SQLERRM);
547:
541: when others then
542: -- rollback;
543: ICX_POR_EXT_UTL.extRollback;
544:
545: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.purgeClassificationData-'||
546: xErrLoc||' '||SQLERRM);
547:
548: -- Bug 2001770
549: -- handle exception ORA-01555: snapshot too old: rollback segment
550: -- number 9 with name "RBS08" too small
551: if (SQLCODE = -01555) then
552: if (gRestartTime < 3) then
553: gRestartTime := gRestartTime + 1;
554: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
555: 'Restart ICX_POR_EXT_PURGE.purgeClassificationData ' ||
556: gRestartTime || ' times');
557: gExceptionOccured := true;
558: -- Bug 2305219, zxzhang, 05/06/2002
558: -- Bug 2305219, zxzhang, 05/06/2002
559: -- purgeClassificationData;
560: purgeClassificationData(pMode, pInvCatId);
561: else
562: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.ERROR_LEVEL,
563: 'Restart ICX_POR_EXT_PURGE.purgeClassificationData too many times');
564: raise ICX_POR_EXT_UTL.gException;
565: end if;
566: else
560: purgeClassificationData(pMode, pInvCatId);
561: else
562: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.ERROR_LEVEL,
563: 'Restart ICX_POR_EXT_PURGE.purgeClassificationData too many times');
564: raise ICX_POR_EXT_UTL.gException;
565: end if;
566: else
567: raise ICX_POR_EXT_UTL.gException;
568: end if;
563: 'Restart ICX_POR_EXT_PURGE.purgeClassificationData too many times');
564: raise ICX_POR_EXT_UTL.gException;
565: end if;
566: else
567: raise ICX_POR_EXT_UTL.gException;
568: end if;
569:
570: END purgeClassificationData;
571:
653: 'AND fsp.inventory_organization_id = m.organization_id) ';
654: END IF;
655:
656: xErrLoc := 270;
657: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
658: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.INFO_LEVEL,
659: 'Query for item purge: ' || xString);
660: END IF;
661:
654: END IF;
655:
656: xErrLoc := 270;
657: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
658: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.INFO_LEVEL,
659: 'Query for item purge: ' || xString);
660: END IF;
661:
662: xErrLoc := 280;
691:
692: xErrLoc := 600;
693: EXCEPTION
694: when others then
695: ICX_POR_EXT_UTL.extRollback;
696:
697: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.openItemCursor-'||
698: xErrLoc||' '||SQLERRM);
699: raise ICX_POR_EXT_UTL.gException;
693: EXCEPTION
694: when others then
695: ICX_POR_EXT_UTL.extRollback;
696:
697: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.openItemCursor-'||
698: xErrLoc||' '||SQLERRM);
699: raise ICX_POR_EXT_UTL.gException;
700: END openItemCursor;
701:
695: ICX_POR_EXT_UTL.extRollback;
696:
697: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.openItemCursor-'||
698: xErrLoc||' '||SQLERRM);
699: raise ICX_POR_EXT_UTL.gException;
700: END openItemCursor;
701:
702: -- Process item records
703: PROCEDURE processItemRecords(pCursor IN tItemCursorType)
715: xErrLoc := 200;
716:
717: xRtItemIds.DELETE;
718:
719: IF (ICX_POR_EXT_UTL.getDatabaseVersion < 9.0) THEN
720: xErrLoc := 150;
721: EXIT WHEN pCursor%NOTFOUND;
722: -- Oracle 8i doesn't support BULK Collect from dynamic SQL
723: FOR i IN 1..ICX_POR_EXT_UTL.gCommitSize LOOP
719: IF (ICX_POR_EXT_UTL.getDatabaseVersion < 9.0) THEN
720: xErrLoc := 150;
721: EXIT WHEN pCursor%NOTFOUND;
722: -- Oracle 8i doesn't support BULK Collect from dynamic SQL
723: FOR i IN 1..ICX_POR_EXT_UTL.gCommitSize LOOP
724: FETCH pCursor
725: INTO xRtItemIds(i);
726: EXIT WHEN pCursor%NOTFOUND;
727: END LOOP;
728: ELSE
729: xErrLoc := 200;
730: FETCH pCursor
731: BULK COLLECT INTO xRtItemIds
732: LIMIT ICX_POR_EXT_UTL.gCommitSize;
733: EXIT WHEN xRtItemIds.COUNT = 0;
734: END IF;
735:
736: xErrLoc := 240;
734: END IF;
735:
736: xErrLoc := 240;
737: FOR i IN 1..xRtItemIds.COUNT LOOP
738: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.DEBUG_LEVEL THEN
739: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.DEBUG_LEVEL,
740: 'Item[rt_item_id: '|| xRtItemIds(i) || ']');
741: END IF;
742:
735:
736: xErrLoc := 240;
737: FOR i IN 1..xRtItemIds.COUNT LOOP
738: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.DEBUG_LEVEL THEN
739: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.DEBUG_LEVEL,
740: 'Item[rt_item_id: '|| xRtItemIds(i) || ']');
741: END IF;
742:
743: xErrLoc := 300;
755: xErrLoc := 600;
756: -- process remaining
757: processBatchData('ITEM', 'OUTLOOP');
758:
759: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
760: 'Total deleted items: ' || gCompletedCount);
761:
762: xErrLoc := 700;
763:
762: xErrLoc := 700;
763:
764: EXCEPTION
765: when others then
766: ICX_POR_EXT_UTL.extRollback;
767:
768: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.processItemRecords-'||
769: xErrLoc||' '||SQLERRM);
770: raise ICX_POR_EXT_UTL.gException;
764: EXCEPTION
765: when others then
766: ICX_POR_EXT_UTL.extRollback;
767:
768: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.processItemRecords-'||
769: xErrLoc||' '||SQLERRM);
770: raise ICX_POR_EXT_UTL.gException;
771: END processItemRecords;
772:
766: ICX_POR_EXT_UTL.extRollback;
767:
768: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.processItemRecords-'||
769: xErrLoc||' '||SQLERRM);
770: raise ICX_POR_EXT_UTL.gException;
771: END processItemRecords;
772:
773: -- Main procedure to purge classification data
774: PROCEDURE purgeItemData (pMode IN PLS_INTEGER,
792:
793: xErrLoc := 120;
794: openItemCursor(pMode, pInvCatItemId, 'DELETED_ITEMS', cItem);
795:
796: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
797: 'Purge items deleted from item masters');
798:
799: xErrLoc := 140;
800: processItemRecords(cItem);
803:
804: xErrLoc := 160;
805: openItemCursor(pMode, pInvCatItemId, 'INVALID_CATGORY_ITEMS', cItem);
806:
807: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
808: 'Purge items with invalid association in MTL_ITEM_CATEGORIES');
809:
810: xErrLoc := 180;
811: processItemRecords(cItem);
828:
829: xErrLoc := 300;
830: ICX_POR_EXT_ITEM.cleanupPrices;
831: EXCEPTION
832: WHEN ICX_POR_EXT_UTL.gException THEN
833: ICX_POR_EXT_UTL.extRollback;
834:
835: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.purgeItemData-'||
836: xErrLoc);
829: xErrLoc := 300;
830: ICX_POR_EXT_ITEM.cleanupPrices;
831: EXCEPTION
832: WHEN ICX_POR_EXT_UTL.gException THEN
833: ICX_POR_EXT_UTL.extRollback;
834:
835: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.purgeItemData-'||
836: xErrLoc);
837: raise ICX_POR_EXT_UTL.gException;
831: EXCEPTION
832: WHEN ICX_POR_EXT_UTL.gException THEN
833: ICX_POR_EXT_UTL.extRollback;
834:
835: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.purgeItemData-'||
836: xErrLoc);
837: raise ICX_POR_EXT_UTL.gException;
838: WHEN OTHERS THEN
839: ICX_POR_EXT_UTL.extRollback;
833: ICX_POR_EXT_UTL.extRollback;
834:
835: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.purgeItemData-'||
836: xErrLoc);
837: raise ICX_POR_EXT_UTL.gException;
838: WHEN OTHERS THEN
839: ICX_POR_EXT_UTL.extRollback;
840:
841: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.purgeItemData-'||
835: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.purgeItemData-'||
836: xErrLoc);
837: raise ICX_POR_EXT_UTL.gException;
838: WHEN OTHERS THEN
839: ICX_POR_EXT_UTL.extRollback;
840:
841: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.purgeItemData-'||
842: xErrLoc||' '||SQLERRM);
843:
837: raise ICX_POR_EXT_UTL.gException;
838: WHEN OTHERS THEN
839: ICX_POR_EXT_UTL.extRollback;
840:
841: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_PURGE.purgeItemData-'||
842: xErrLoc||' '||SQLERRM);
843:
844: -- Bug 2001770
845: -- handle exception ORA-01555: snapshot too old: rollback segment
846: -- number 9 with name "RBS08" too small
847: if (SQLCODE = -01555) then
848: if (gRestartTime < 3) then
849: gRestartTime := gRestartTime + 1;
850: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
851: 'Restart ICX_POR_EXT_PURGE.purgeItemData ' ||
852: gRestartTime || ' times');
853: gExceptionOccured := true;
854:
853: gExceptionOccured := true;
854:
855: purgeItemData(pMode, pInvCatItemId);
856: else
857: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.ERROR_LEVEL,
858: 'Restart ICX_POR_EXT_PURGE.purgeItemData too many times');
859: raise ICX_POR_EXT_UTL.gException;
860: end if;
861: else
855: purgeItemData(pMode, pInvCatItemId);
856: else
857: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.ERROR_LEVEL,
858: 'Restart ICX_POR_EXT_PURGE.purgeItemData too many times');
859: raise ICX_POR_EXT_UTL.gException;
860: end if;
861: else
862: raise ICX_POR_EXT_UTL.gException;
863: end if;
858: 'Restart ICX_POR_EXT_PURGE.purgeItemData too many times');
859: raise ICX_POR_EXT_UTL.gException;
860: end if;
861: else
862: raise ICX_POR_EXT_UTL.gException;
863: end if;
864:
865: END purgeItemData;
866: