73: xShot varchar2(2000) := 'SnapShot('||pMode||')['||pIndex||']--';
74: BEGIN
75: IF (pMode = 'ADD') THEN
76: xShot := xShot || ' gAddRtCategoryId: ' ||
77: ICX_POR_EXT_UTL.getTableElement(gAddRtCategoryIds, pIndex) || ',';
78: xShot := xShot || ' gAddCategoryKey: '||
79: ICX_POR_EXT_UTL.getTableElement(gAddCategoryKeys, pIndex) || ',';
80: xShot := xShot || ' gAddCategoryName: '||
81: ICX_POR_EXT_UTL.getTableElement(gAddCategoryNames, pIndex) || ',';
75: IF (pMode = 'ADD') THEN
76: xShot := xShot || ' gAddRtCategoryId: ' ||
77: ICX_POR_EXT_UTL.getTableElement(gAddRtCategoryIds, pIndex) || ',';
78: xShot := xShot || ' gAddCategoryKey: '||
79: ICX_POR_EXT_UTL.getTableElement(gAddCategoryKeys, pIndex) || ',';
80: xShot := xShot || ' gAddCategoryName: '||
81: ICX_POR_EXT_UTL.getTableElement(gAddCategoryNames, pIndex) || ',';
82: xShot := xShot || ' gAddLanguage: '||
83: ICX_POR_EXT_UTL.getTableElement(gAddLanguages, pIndex) || ',';
77: ICX_POR_EXT_UTL.getTableElement(gAddRtCategoryIds, pIndex) || ',';
78: xShot := xShot || ' gAddCategoryKey: '||
79: ICX_POR_EXT_UTL.getTableElement(gAddCategoryKeys, pIndex) || ',';
80: xShot := xShot || ' gAddCategoryName: '||
81: ICX_POR_EXT_UTL.getTableElement(gAddCategoryNames, pIndex) || ',';
82: xShot := xShot || ' gAddLanguage: '||
83: ICX_POR_EXT_UTL.getTableElement(gAddLanguages, pIndex) || ',';
84: xShot := xShot || ' gAddSourceLang: '||
85: ICX_POR_EXT_UTL.getTableElement(gAddSourceLangs, pIndex);
79: ICX_POR_EXT_UTL.getTableElement(gAddCategoryKeys, pIndex) || ',';
80: xShot := xShot || ' gAddCategoryName: '||
81: ICX_POR_EXT_UTL.getTableElement(gAddCategoryNames, pIndex) || ',';
82: xShot := xShot || ' gAddLanguage: '||
83: ICX_POR_EXT_UTL.getTableElement(gAddLanguages, pIndex) || ',';
84: xShot := xShot || ' gAddSourceLang: '||
85: ICX_POR_EXT_UTL.getTableElement(gAddSourceLangs, pIndex);
86: ELSIF (pMode = 'ADDNEW') THEN
87: xShot := xShot || ' gAddNewRtCategoryId: '||
81: ICX_POR_EXT_UTL.getTableElement(gAddCategoryNames, pIndex) || ',';
82: xShot := xShot || ' gAddLanguage: '||
83: ICX_POR_EXT_UTL.getTableElement(gAddLanguages, pIndex) || ',';
84: xShot := xShot || ' gAddSourceLang: '||
85: ICX_POR_EXT_UTL.getTableElement(gAddSourceLangs, pIndex);
86: ELSIF (pMode = 'ADDNEW') THEN
87: xShot := xShot || ' gAddNewRtCategoryId: '||
88: ICX_POR_EXT_UTL.getTableElement(gAddNewRtCategoryIds, pIndex) || ',';
89: xShot := xShot || ' gAddNewCategoryKey: ' ||
84: xShot := xShot || ' gAddSourceLang: '||
85: ICX_POR_EXT_UTL.getTableElement(gAddSourceLangs, pIndex);
86: ELSIF (pMode = 'ADDNEW') THEN
87: xShot := xShot || ' gAddNewRtCategoryId: '||
88: ICX_POR_EXT_UTL.getTableElement(gAddNewRtCategoryIds, pIndex) || ',';
89: xShot := xShot || ' gAddNewCategoryKey: ' ||
90: ICX_POR_EXT_UTL.getTableElement(gAddNewCategoryKeys, pIndex);
91: ELSIF (pMode = 'UPDATE') THEN
92: xShot := xShot || ' gUpdateRtCategoryId: ' ||
86: ELSIF (pMode = 'ADDNEW') THEN
87: xShot := xShot || ' gAddNewRtCategoryId: '||
88: ICX_POR_EXT_UTL.getTableElement(gAddNewRtCategoryIds, pIndex) || ',';
89: xShot := xShot || ' gAddNewCategoryKey: ' ||
90: ICX_POR_EXT_UTL.getTableElement(gAddNewCategoryKeys, pIndex);
91: ELSIF (pMode = 'UPDATE') THEN
92: xShot := xShot || ' gUpdateRtCategoryId: ' ||
93: ICX_POR_EXT_UTL.getTableElement(gUpdateRtCategoryIds, pIndex) || ',';
94: xShot := xShot || ' gUpdateCategoryKey: ' ||
89: xShot := xShot || ' gAddNewCategoryKey: ' ||
90: ICX_POR_EXT_UTL.getTableElement(gAddNewCategoryKeys, pIndex);
91: ELSIF (pMode = 'UPDATE') THEN
92: xShot := xShot || ' gUpdateRtCategoryId: ' ||
93: ICX_POR_EXT_UTL.getTableElement(gUpdateRtCategoryIds, pIndex) || ',';
94: xShot := xShot || ' gUpdateCategoryKey: ' ||
95: ICX_POR_EXT_UTL.getTableElement(gUpdateCategoryKeys, pIndex) || ',';
96: xShot := xShot || ' gUpdateCategoryName: ' ||
97: ICX_POR_EXT_UTL.getTableElement(gUpdateCategoryNames, pIndex) || ',';
91: ELSIF (pMode = 'UPDATE') THEN
92: xShot := xShot || ' gUpdateRtCategoryId: ' ||
93: ICX_POR_EXT_UTL.getTableElement(gUpdateRtCategoryIds, pIndex) || ',';
94: xShot := xShot || ' gUpdateCategoryKey: ' ||
95: ICX_POR_EXT_UTL.getTableElement(gUpdateCategoryKeys, pIndex) || ',';
96: xShot := xShot || ' gUpdateCategoryName: ' ||
97: ICX_POR_EXT_UTL.getTableElement(gUpdateCategoryNames, pIndex) || ',';
98: xShot := xShot || ' gUpdateLanguage: ' ||
99: ICX_POR_EXT_UTL.getTableElement(gUpdateLanguages, pIndex) || ',';
93: ICX_POR_EXT_UTL.getTableElement(gUpdateRtCategoryIds, pIndex) || ',';
94: xShot := xShot || ' gUpdateCategoryKey: ' ||
95: ICX_POR_EXT_UTL.getTableElement(gUpdateCategoryKeys, pIndex) || ',';
96: xShot := xShot || ' gUpdateCategoryName: ' ||
97: ICX_POR_EXT_UTL.getTableElement(gUpdateCategoryNames, pIndex) || ',';
98: xShot := xShot || ' gUpdateLanguage: ' ||
99: ICX_POR_EXT_UTL.getTableElement(gUpdateLanguages, pIndex) || ',';
100: xShot := xShot || ' gUpdateSourceLang: ' ||
101: ICX_POR_EXT_UTL.getTableElement(gUpdateSourceLangs, pIndex);
95: ICX_POR_EXT_UTL.getTableElement(gUpdateCategoryKeys, pIndex) || ',';
96: xShot := xShot || ' gUpdateCategoryName: ' ||
97: ICX_POR_EXT_UTL.getTableElement(gUpdateCategoryNames, pIndex) || ',';
98: xShot := xShot || ' gUpdateLanguage: ' ||
99: ICX_POR_EXT_UTL.getTableElement(gUpdateLanguages, pIndex) || ',';
100: xShot := xShot || ' gUpdateSourceLang: ' ||
101: ICX_POR_EXT_UTL.getTableElement(gUpdateSourceLangs, pIndex);
102: END IF;
103:
97: ICX_POR_EXT_UTL.getTableElement(gUpdateCategoryNames, pIndex) || ',';
98: xShot := xShot || ' gUpdateLanguage: ' ||
99: ICX_POR_EXT_UTL.getTableElement(gUpdateLanguages, pIndex) || ',';
100: xShot := xShot || ' gUpdateSourceLang: ' ||
101: ICX_POR_EXT_UTL.getTableElement(gUpdateSourceLangs, pIndex);
102: END IF;
103:
104: RETURN xShot;
105: END snapShot;
123: xRowIds DBMS_SQL.UROWID_TABLE;
124:
125: BEGIN
126:
127: IF (ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.DETIL_LEVEL) THEN
128: FOR i in 1..gAddRtCategoryIds.COUNT LOOP
129: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.DETIL_LEVEL, snapShot(i, 'ADD'));
130: END LOOP;
131: FOR i in 1..gAddNewRtCategoryIds.COUNT LOOP
125: BEGIN
126:
127: IF (ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.DETIL_LEVEL) THEN
128: FOR i in 1..gAddRtCategoryIds.COUNT LOOP
129: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.DETIL_LEVEL, snapShot(i, 'ADD'));
130: END LOOP;
131: FOR i in 1..gAddNewRtCategoryIds.COUNT LOOP
132: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.DETIL_LEVEL, snapShot(i, 'ADDNEW'));
133: END LOOP;
128: FOR i in 1..gAddRtCategoryIds.COUNT LOOP
129: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.DETIL_LEVEL, snapShot(i, 'ADD'));
130: END LOOP;
131: FOR i in 1..gAddNewRtCategoryIds.COUNT LOOP
132: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.DETIL_LEVEL, snapShot(i, 'ADDNEW'));
133: END LOOP;
134: END IF;
135:
136: xErrLoc := 200;
135:
136: xErrLoc := 200;
137:
138: -- Add categories
139: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
140: ICX_POR_EXT_UTL.debug('Insert icx_cat_categories_tl');
141: END IF;
142:
143: FORALL i IN 1..gAddRtCategoryIds.COUNT
136: xErrLoc := 200;
137:
138: -- Add categories
139: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
140: ICX_POR_EXT_UTL.debug('Insert icx_cat_categories_tl');
141: END IF;
142:
143: FORALL i IN 1..gAddRtCategoryIds.COUNT
144: INSERT INTO icx_cat_categories_tl(
162: -- For categories, we don't replicate, just take it as is
163: IF (pType = TEMPLATE_HEADER_TYPE) THEN
164: -- template header
165: xErrLoc := 300;
166: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
167: ICX_POR_EXT_UTL.debug('Replicate template headers accross ' ||
168: 'installed languages');
169: END IF;
170: -- Replicate accross installed langs
163: IF (pType = TEMPLATE_HEADER_TYPE) THEN
164: -- template header
165: xErrLoc := 300;
166: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
167: ICX_POR_EXT_UTL.debug('Replicate template headers accross ' ||
168: 'installed languages');
169: END IF;
170: -- Replicate accross installed langs
171: FORALL i IN 1..gAddRtCategoryIds.COUNT
192:
193: xErrLoc := 400;
194: xMode := 'ADDNEW';
195:
196: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
197: ICX_POR_EXT_UTL.debug('Create ICX_POR_CATEGORY_DATA_SOURCES records');
198: END IF;
199:
200: -- Creates ICX_POR_CATEGORY_DATA_SOURCES records
193: xErrLoc := 400;
194: xMode := 'ADDNEW';
195:
196: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
197: ICX_POR_EXT_UTL.debug('Create ICX_POR_CATEGORY_DATA_SOURCES records');
198: END IF;
199:
200: -- Creates ICX_POR_CATEGORY_DATA_SOURCES records
201:
226: where external_source = 'Oracle'
227: and external_source_key = key);
228:
229: xErrLoc := 500;
230: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
231: ICX_POR_EXT_UTL.debug('Create ICX_POR_CATEGORY_ORDER_MAP records');
232: END IF;
233:
234: -- Creates ICX_POR_CATEGORY_ORDER_MAP records
227: and external_source_key = key);
228:
229: xErrLoc := 500;
230: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
231: ICX_POR_EXT_UTL.debug('Create ICX_POR_CATEGORY_ORDER_MAP records');
232: END IF;
233:
234: -- Creates ICX_POR_CATEGORY_ORDER_MAP records
235: IF (pType = CATEGORY_TYPE) THEN
244: ICX_POR_EXTRACTOR.gLoginId);
245: END IF;
246:
247: xErrLoc := 600;
248: ICX_POR_EXT_UTL.extAFCommit;
249: clearTables('ADD');
250:
251: EXCEPTION
252: when others then
249: clearTables('ADD');
250:
251: EXCEPTION
252: when others then
253: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.addCategories-'||
254: xErrLoc||' '||SQLERRM);
255: ICX_POR_EXT_UTL.pushError(snapShot(SQL%ROWCOUNT+1, xMode));
256: -- rollback;
257: ICX_POR_EXT_UTL.extRollback;
251: EXCEPTION
252: when others then
253: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.addCategories-'||
254: xErrLoc||' '||SQLERRM);
255: ICX_POR_EXT_UTL.pushError(snapShot(SQL%ROWCOUNT+1, xMode));
256: -- rollback;
257: ICX_POR_EXT_UTL.extRollback;
258:
259: raise ICX_POR_EXT_UTL.gException;
253: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.addCategories-'||
254: xErrLoc||' '||SQLERRM);
255: ICX_POR_EXT_UTL.pushError(snapShot(SQL%ROWCOUNT+1, xMode));
256: -- rollback;
257: ICX_POR_EXT_UTL.extRollback;
258:
259: raise ICX_POR_EXT_UTL.gException;
260:
261: END addCategories;
255: ICX_POR_EXT_UTL.pushError(snapShot(SQL%ROWCOUNT+1, xMode));
256: -- rollback;
257: ICX_POR_EXT_UTL.extRollback;
258:
259: raise ICX_POR_EXT_UTL.gException;
260:
261: END addCategories;
262:
263: -- Update categories
275: xRowIds DBMS_SQL.UROWID_TABLE;
276:
277: BEGIN
278:
279: IF (ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.DETIL_LEVEL) THEN
280: FOR i in 1..gUpdateRtCategoryIds.COUNT LOOP
281: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.DETIL_LEVEL, snapShot(i, xMode));
282: END LOOP;
283: END IF;
277: BEGIN
278:
279: IF (ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.DETIL_LEVEL) THEN
280: FOR i in 1..gUpdateRtCategoryIds.COUNT LOOP
281: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.DETIL_LEVEL, snapShot(i, xMode));
282: END LOOP;
283: END IF;
284:
285: xErrLoc := 100;
282: END LOOP;
283: END IF;
284:
285: xErrLoc := 100;
286: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
287: ICX_POR_EXT_UTL.debug('Set rebuild job num');
288: END IF;
289: -- set rebuild_job since category name is changed
290:
283: END IF;
284:
285: xErrLoc := 100;
286: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
287: ICX_POR_EXT_UTL.debug('Set rebuild job num');
288: END IF;
289: -- set rebuild_job since category name is changed
290:
291: IF (pType = CATEGORY_TYPE) THEN
303:
304: xErrLoc := 220;
305: FETCH cRebuildItems
306: BULK COLLECT INTO xRowIds
307: LIMIT ICX_POR_EXT_UTL.gCommitSize;
308: EXIT WHEN xRowIds.COUNT = 0;
309:
310: xErrLoc := 240;
311: FORALL j IN 1..xRowIds.COUNT
319: program_id = ICX_POR_EXTRACTOR.gProgramId,
320: program_update_date = SYSDATE
321: WHERE rowid = xRowIds(j);
322:
323: ICX_POR_EXT_UTL.extAFCommit;
324:
325: END LOOP;
326:
327: xErrLoc := 300;
330:
331: END IF;
332:
333: xErrLoc := 400;
334: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
335: ICX_POR_EXT_UTL.debug('Update ICX_CAT_CATEGORIES_TL');
336: END IF;
337:
338: FORALL i IN 1..gUpdateRtCategoryIds.COUNT
331: END IF;
332:
333: xErrLoc := 400;
334: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
335: ICX_POR_EXT_UTL.debug('Update ICX_CAT_CATEGORIES_TL');
336: END IF;
337:
338: FORALL i IN 1..gUpdateRtCategoryIds.COUNT
339: UPDATE icx_cat_categories_tl
349: program_update_date = SYSDATE
350: WHERE rt_category_id = gUpdateRtCategoryIds(i)
351: AND language = gUpdateLanguages(i);
352:
353: ICX_POR_EXT_UTL.extAFCommit;
354:
355: xErrLoc := 500;
356: clearTables(xMode);
357:
360: IF (cRebuildItems%ISOPEN) THEN
361: CLOSE cRebuildItems;
362: END IF;
363:
364: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.updateCategories-'||
365: xErrLoc||' '||SQLERRM);
366: ICX_POR_EXT_UTL.pushError(snapShot(SQL%ROWCOUNT+1, xMode));
367:
368: ICX_POR_EXT_UTL.extRollback;
362: END IF;
363:
364: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.updateCategories-'||
365: xErrLoc||' '||SQLERRM);
366: ICX_POR_EXT_UTL.pushError(snapShot(SQL%ROWCOUNT+1, xMode));
367:
368: ICX_POR_EXT_UTL.extRollback;
369:
370: raise ICX_POR_EXT_UTL.gException;
364: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.updateCategories-'||
365: xErrLoc||' '||SQLERRM);
366: ICX_POR_EXT_UTL.pushError(snapShot(SQL%ROWCOUNT+1, xMode));
367:
368: ICX_POR_EXT_UTL.extRollback;
369:
370: raise ICX_POR_EXT_UTL.gException;
371:
372: END updateCategories;
366: ICX_POR_EXT_UTL.pushError(snapShot(SQL%ROWCOUNT+1, xMode));
367:
368: ICX_POR_EXT_UTL.extRollback;
369:
370: raise ICX_POR_EXT_UTL.gException;
371:
372: END updateCategories;
373:
374: -- Process batch data
382: IF (pMode = 'OUTLOOP' OR
383: -- Since we will commit the changes as a transaction in addCategories,
384: -- we need to re-calculate the correct commit size
385: (pType = CATEGORY_TYPE AND
386: (ICX_POR_EXT_UTL.gCommitSize < 3 OR
387: gAddRtCategoryIds.COUNT >= ICX_POR_EXT_UTL.gCommitSize/3)) OR
388: (pType = TEMPLATE_HEADER_TYPE AND
389: (ICX_POR_EXT_UTL.gCommitSize <
390: ICX_POR_EXTRACTOR.gInstalledLanguageCount+2 OR
383: -- Since we will commit the changes as a transaction in addCategories,
384: -- we need to re-calculate the correct commit size
385: (pType = CATEGORY_TYPE AND
386: (ICX_POR_EXT_UTL.gCommitSize < 3 OR
387: gAddRtCategoryIds.COUNT >= ICX_POR_EXT_UTL.gCommitSize/3)) OR
388: (pType = TEMPLATE_HEADER_TYPE AND
389: (ICX_POR_EXT_UTL.gCommitSize <
390: ICX_POR_EXTRACTOR.gInstalledLanguageCount+2 OR
391: gAddRtCategoryIds.COUNT >=
385: (pType = CATEGORY_TYPE AND
386: (ICX_POR_EXT_UTL.gCommitSize < 3 OR
387: gAddRtCategoryIds.COUNT >= ICX_POR_EXT_UTL.gCommitSize/3)) OR
388: (pType = TEMPLATE_HEADER_TYPE AND
389: (ICX_POR_EXT_UTL.gCommitSize <
390: ICX_POR_EXTRACTOR.gInstalledLanguageCount+2 OR
391: gAddRtCategoryIds.COUNT >=
392: ICX_POR_EXT_UTL.gCommitSize/
393: (ICX_POR_EXTRACTOR.gInstalledLanguageCount+2))))
388: (pType = TEMPLATE_HEADER_TYPE AND
389: (ICX_POR_EXT_UTL.gCommitSize <
390: ICX_POR_EXTRACTOR.gInstalledLanguageCount+2 OR
391: gAddRtCategoryIds.COUNT >=
392: ICX_POR_EXT_UTL.gCommitSize/
393: (ICX_POR_EXTRACTOR.gInstalledLanguageCount+2))))
394: THEN
395: xErrLoc := 200;
396: IF (pType = CATEGORY_TYPE) THEN
393: (ICX_POR_EXTRACTOR.gInstalledLanguageCount+2))))
394: THEN
395: xErrLoc := 200;
396: IF (pType = CATEGORY_TYPE) THEN
397: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
398: 'Process batch category extract -- Pending[Insert: ' ||
399: gAddRtCategoryIds.COUNT || '], Completed[' || gCompletedCount || ']');
400: ELSE
401: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
397: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
398: 'Process batch category extract -- Pending[Insert: ' ||
399: gAddRtCategoryIds.COUNT || '], Completed[' || gCompletedCount || ']');
400: ELSE
401: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
402: 'Process batch template header extract -- Pending[Insert: ' ||
403: gAddRtCategoryIds.COUNT || '], Completed[' || gCompletedCount || ']');
404: END IF;
405:
407: addCategories(pType);
408: END IF;
409:
410: IF (pMode = 'OUTLOOP' OR
411: gUpdateRtCategoryIds.COUNT >= ICX_POR_EXT_UTL.gCommitSize)
412: THEN
413: xErrLoc := 300;
414: IF (pType = CATEGORY_TYPE) THEN
415: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
411: gUpdateRtCategoryIds.COUNT >= ICX_POR_EXT_UTL.gCommitSize)
412: THEN
413: xErrLoc := 300;
414: IF (pType = CATEGORY_TYPE) THEN
415: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
416: 'Process batch category extract -- Pending[Update: ' ||
417: gUpdateRtCategoryIds.COUNT || '], Completed[' ||
418: gCompletedCount || ']');
419: ELSE
416: 'Process batch category extract -- Pending[Update: ' ||
417: gUpdateRtCategoryIds.COUNT || '], Completed[' ||
418: gCompletedCount || ']');
419: ELSE
420: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
421: 'Process batch template header extract -- Pending[Update: ' ||
422: gUpdateRtCategoryIds.COUNT || '], Completed[' || gCompletedCount || ']');
423: END IF;
424:
427: END IF;
428:
429: xErrLoc := 400;
430: EXCEPTION
431: when ICX_POR_EXT_UTL.gException then
432: -- rollback;
433: ICX_POR_EXT_UTL.extRollback;
434:
435: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.processBatchData-'||
429: xErrLoc := 400;
430: EXCEPTION
431: when ICX_POR_EXT_UTL.gException then
432: -- rollback;
433: ICX_POR_EXT_UTL.extRollback;
434:
435: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.processBatchData-'||
436: xErrLoc);
437: raise ICX_POR_EXT_UTL.gException;
431: when ICX_POR_EXT_UTL.gException then
432: -- rollback;
433: ICX_POR_EXT_UTL.extRollback;
434:
435: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.processBatchData-'||
436: xErrLoc);
437: raise ICX_POR_EXT_UTL.gException;
438: when others then
439: -- rollback;
433: ICX_POR_EXT_UTL.extRollback;
434:
435: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.processBatchData-'||
436: xErrLoc);
437: raise ICX_POR_EXT_UTL.gException;
438: when others then
439: -- rollback;
440: ICX_POR_EXT_UTL.extRollback;
441:
436: xErrLoc);
437: raise ICX_POR_EXT_UTL.gException;
438: when others then
439: -- rollback;
440: ICX_POR_EXT_UTL.extRollback;
441:
442: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.processBatchData-'||
443: xErrLoc||' '||SQLERRM);
444: raise ICX_POR_EXT_UTL.gException;
438: when others then
439: -- rollback;
440: ICX_POR_EXT_UTL.extRollback;
441:
442: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.processBatchData-'||
443: xErrLoc||' '||SQLERRM);
444: raise ICX_POR_EXT_UTL.gException;
445: END processBatchData;
446:
440: ICX_POR_EXT_UTL.extRollback;
441:
442: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.processBatchData-'||
443: xErrLoc||' '||SQLERRM);
444: raise ICX_POR_EXT_UTL.gException;
445: END processBatchData;
446:
447: --------------------------------------------------------------
448: -- Extract Classfication Data --
472: xStructureId
473: from mtl_default_sets_view
474: where functional_area_id = 2;
475:
476: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
477: 'Category Set Information[category_set_id: ' || xCategorySetId ||
478: ', validate_flag: ' || xValidateFlag ||
479: ', structure_id: ' || xStructureId || ']');
480:
544:
545: xErrLoc := 280;
546: xString := xString || 'order by 1 ';
547:
548: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
549: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.INFO_LEVEL,
550: 'Query for category extraction: ' || xString);
551: END IF;
552:
545: xErrLoc := 280;
546: xString := xString || 'order by 1 ';
547:
548: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
549: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.INFO_LEVEL,
550: 'Query for category extraction: ' || xString);
551: END IF;
552:
553: xErrLoc := 300;
619: 'and icat.language (+) = :base_lang ';
620:
621: xErrLoc := 470;
622:
623: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
624: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.INFO_LEVEL,
625: 'Query for template header extraction: ' || xString);
626: END IF;
627:
620:
621: xErrLoc := 470;
622:
623: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.INFO_LEVEL THEN
624: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.INFO_LEVEL,
625: 'Query for template header extraction: ' || xString);
626: END IF;
627:
628: xErrLoc := 500;
632: END IF;
633:
634: xErrLoc := 600;
635: EXCEPTION
636: when ICX_POR_EXT_UTL.gException then
637: -- rollback;
638: ICX_POR_EXT_UTL.extRollback;
639:
640: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.openClassCursor-'||
634: xErrLoc := 600;
635: EXCEPTION
636: when ICX_POR_EXT_UTL.gException then
637: -- rollback;
638: ICX_POR_EXT_UTL.extRollback;
639:
640: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.openClassCursor-'||
641: xErrLoc);
642: raise ICX_POR_EXT_UTL.gException;
636: when ICX_POR_EXT_UTL.gException then
637: -- rollback;
638: ICX_POR_EXT_UTL.extRollback;
639:
640: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.openClassCursor-'||
641: xErrLoc);
642: raise ICX_POR_EXT_UTL.gException;
643: when others then
644: -- rollback;
638: ICX_POR_EXT_UTL.extRollback;
639:
640: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.openClassCursor-'||
641: xErrLoc);
642: raise ICX_POR_EXT_UTL.gException;
643: when others then
644: -- rollback;
645: ICX_POR_EXT_UTL.extRollback;
646:
641: xErrLoc);
642: raise ICX_POR_EXT_UTL.gException;
643: when others then
644: -- rollback;
645: ICX_POR_EXT_UTL.extRollback;
646:
647: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.openClassCursor-'||
648: xErrLoc||' '||SQLERRM);
649: raise ICX_POR_EXT_UTL.gException;
643: when others then
644: -- rollback;
645: ICX_POR_EXT_UTL.extRollback;
646:
647: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.openClassCursor-'||
648: xErrLoc||' '||SQLERRM);
649: raise ICX_POR_EXT_UTL.gException;
650: END openClassCursor;
651:
645: ICX_POR_EXT_UTL.extRollback;
646:
647: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.openClassCursor-'||
648: xErrLoc||' '||SQLERRM);
649: raise ICX_POR_EXT_UTL.gException;
650: END openClassCursor;
651:
652: -- Process classification records
653: PROCEDURE processClassRecords(pType IN PLS_INTEGER,
679: xSourceLangs.DELETE;
680: xRtCategoryIds.DELETE;
681: xOldCategoryNames.DELETE;
682:
683: IF (ICX_POR_EXT_UTL.getDatabaseVersion < 9.0) THEN
684: xErrLoc := 150;
685: EXIT WHEN pCursor%NOTFOUND;
686: -- Oracle 8i doesn't support BULK Collect from dynamic SQL
687: FOR i IN 1..ICX_POR_EXT_UTL.gCommitSize LOOP
683: IF (ICX_POR_EXT_UTL.getDatabaseVersion < 9.0) THEN
684: xErrLoc := 150;
685: EXIT WHEN pCursor%NOTFOUND;
686: -- Oracle 8i doesn't support BULK Collect from dynamic SQL
687: FOR i IN 1..ICX_POR_EXT_UTL.gCommitSize LOOP
688: FETCH pCursor
689: INTO xCategoryIds(i), xCategoryNames(i),
690: xLanguages(i), xSourceLangs(i),
691: xRtCategoryIds(i), xOldCategoryNames(i);
696: FETCH pCursor
697: BULK COLLECT INTO xCategoryIds, xCategoryNames,
698: xLanguages, xSourceLangs,
699: xRtCategoryIds, xOldCategoryNames
700: LIMIT ICX_POR_EXT_UTL.gCommitSize;
701: EXIT WHEN xCategoryIds.COUNT = 0;
702: END IF;
703:
704: xErrLoc := 240;
702: END IF;
703:
704: xErrLoc := 240;
705: FOR i IN 1..xCategoryIds.COUNT LOOP
706: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.DEBUG_LEVEL THEN
707: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.DEBUG_LEVEL,
708: 'Classification[category_id: '|| xCategoryIds(i) ||
709: ', category_name: '|| xCategoryNames(i) ||
710: ', language: '|| xLanguages(i) ||
703:
704: xErrLoc := 240;
705: FOR i IN 1..xCategoryIds.COUNT LOOP
706: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.DEBUG_LEVEL THEN
707: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.DEBUG_LEVEL,
708: 'Classification[category_id: '|| xCategoryIds(i) ||
709: ', category_name: '|| xCategoryNames(i) ||
710: ', language: '|| xLanguages(i) ||
711: ', source_lang: '|| xSourceLangs(i) ||
722: -- Check do we have rows for other languages?
723: IF (gLastRtCategoryId <> -1 and
724: gLastCategoryKey = to_char(xCategoryIds(i))) THEN
725: xRtCategoryID := gLastRtCategoryId;
726: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.DEBUG_LEVEL THEN
727: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.DEBUG_LEVEL,
728: 'Found category id with other language:' || xRtCategoryId);
729: END IF;
730: ELSE
723: IF (gLastRtCategoryId <> -1 and
724: gLastCategoryKey = to_char(xCategoryIds(i))) THEN
725: xRtCategoryID := gLastRtCategoryId;
726: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.DEBUG_LEVEL THEN
727: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.DEBUG_LEVEL,
728: 'Found category id with other language:' || xRtCategoryId);
729: END IF;
730: ELSE
731: xErrLoc := 330;
732: select icx_por_categoryid.nextval
733: into xRtCategoryId
734: from dual;
735: xErrLoc := 350;
736: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.DEBUG_LEVEL THEN
737: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.DEBUG_LEVEL,
738: 'Create a new category id:' || xRtCategoryId);
739: END IF;
740: xPendingCount := gAddNewRtCategoryIds.COUNT + 1;
733: into xRtCategoryId
734: from dual;
735: xErrLoc := 350;
736: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.DEBUG_LEVEL THEN
737: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.DEBUG_LEVEL,
738: 'Create a new category id:' || xRtCategoryId);
739: END IF;
740: xPendingCount := gAddNewRtCategoryIds.COUNT + 1;
741: gAddNewRtCategoryIds(xPendingCount) := xRtCategoryId;
748: xErrLoc := 360;
749: select icx_por_categoryid.nextval
750: into xRtCategoryId
751: from dual;
752: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.DEBUG_LEVEL THEN
753: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.DEBUG_LEVEL,
754: 'Create new category id:' || xRtCategoryId);
755: END IF;
756: xPendingCount := gAddNewRtCategoryIds.COUNT + 1;
749: select icx_por_categoryid.nextval
750: into xRtCategoryId
751: from dual;
752: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.DEBUG_LEVEL THEN
753: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.DEBUG_LEVEL,
754: 'Create new category id:' || xRtCategoryId);
755: END IF;
756: xPendingCount := gAddNewRtCategoryIds.COUNT + 1;
757: gAddNewRtCategoryIds(xPendingCount) := xRtCategoryId;
801: gUpdateLanguages(xPendingCount) := ICX_POR_EXTRACTOR.gBaseLang;
802: gUpdateSourceLangs(xPendingCount) := ICX_POR_EXTRACTOR.gBaseLang;
803: END IF;
804: ELSE
805: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.DEBUG_LEVEL THEN
806: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.DEBUG_LEVEL,
807: 'Category name is the same, no action needed');
808: END IF;
809: END IF;
802: gUpdateSourceLangs(xPendingCount) := ICX_POR_EXTRACTOR.gBaseLang;
803: END IF;
804: ELSE
805: IF ICX_POR_EXT_UTL.gDebugLevel >= ICX_POR_EXT_UTL.DEBUG_LEVEL THEN
806: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.DEBUG_LEVEL,
807: 'Category name is the same, no action needed');
808: END IF;
809: END IF;
810: END IF;
821: -- process remaining
822: processBatchData(pType, 'OUTLOOP');
823:
824: IF (pType = CATEGORY_TYPE) THEN
825: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
826: 'Total processed categories: ' || gCompletedCount);
827: ELSE
828: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
829: 'Total processed template headers: ' || gCompletedCount);
824: IF (pType = CATEGORY_TYPE) THEN
825: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
826: 'Total processed categories: ' || gCompletedCount);
827: ELSE
828: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
829: 'Total processed template headers: ' || gCompletedCount);
830: END IF;
831:
832: EXCEPTION
829: 'Total processed template headers: ' || gCompletedCount);
830: END IF;
831:
832: EXCEPTION
833: when ICX_POR_EXT_UTL.gException then
834: -- rollback;
835: ICX_POR_EXT_UTL.extRollback;
836:
837: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.processClassRecords-'||
831:
832: EXCEPTION
833: when ICX_POR_EXT_UTL.gException then
834: -- rollback;
835: ICX_POR_EXT_UTL.extRollback;
836:
837: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.processClassRecords-'||
838: xErrLoc);
839: raise ICX_POR_EXT_UTL.gException;
833: when ICX_POR_EXT_UTL.gException then
834: -- rollback;
835: ICX_POR_EXT_UTL.extRollback;
836:
837: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.processClassRecords-'||
838: xErrLoc);
839: raise ICX_POR_EXT_UTL.gException;
840: when others then
841: -- rollback;
835: ICX_POR_EXT_UTL.extRollback;
836:
837: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.processClassRecords-'||
838: xErrLoc);
839: raise ICX_POR_EXT_UTL.gException;
840: when others then
841: -- rollback;
842: ICX_POR_EXT_UTL.extRollback;
843:
838: xErrLoc);
839: raise ICX_POR_EXT_UTL.gException;
840: when others then
841: -- rollback;
842: ICX_POR_EXT_UTL.extRollback;
843:
844: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.processClassRecords-'||
845: xErrLoc||' '||SQLERRM);
846: raise ICX_POR_EXT_UTL.gException;
840: when others then
841: -- rollback;
842: ICX_POR_EXT_UTL.extRollback;
843:
844: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.processClassRecords-'||
845: xErrLoc||' '||SQLERRM);
846: raise ICX_POR_EXT_UTL.gException;
847: END processClassRecords;
848:
842: ICX_POR_EXT_UTL.extRollback;
843:
844: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.processClassRecords-'||
845: xErrLoc||' '||SQLERRM);
846: raise ICX_POR_EXT_UTL.gException;
847: END processClassRecords;
848:
849: -- Main procedure
850: PROCEDURE extractClassificationData
855: BEGIN
856: xErrLoc := 100;
857: IF (ICX_POR_EXTRACTOR.gLoaderValue.load_categories = 'Y') THEN
858:
859: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
860: 'Extract oracle categories');
861:
862: xErrLoc := 120;
863: openClassCursor(CATEGORY_TYPE, cClass);
876: gCompletedCount := 0;
877:
878: IF (ICX_POR_EXTRACTOR.gLoaderValue.load_template_headers = 'Y') THEN
879:
880: ICX_POR_EXT_UTL.debug(ICX_POR_EXT_UTL.MUST_LEVEL,
881: 'Extract template headers');
882:
883: xErrLoc := 220;
884: openClassCursor(TEMPLATE_HEADER_TYPE, cClass);
895:
896: xErrLoc := 300;
897:
898: EXCEPTION
899: when ICX_POR_EXT_UTL.gException then
900: -- rollback;
901: ICX_POR_EXT_UTL.extRollback;
902:
903: IF (cClass%ISOPEN) THEN
897:
898: EXCEPTION
899: when ICX_POR_EXT_UTL.gException then
900: -- rollback;
901: ICX_POR_EXT_UTL.extRollback;
902:
903: IF (cClass%ISOPEN) THEN
904: CLOSE cClass;
905: END IF;
903: IF (cClass%ISOPEN) THEN
904: CLOSE cClass;
905: END IF;
906:
907: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.extractClassificationData-'||
908: xErrLoc);
909: raise ICX_POR_EXT_UTL.gException;
910: when others then
911: -- rollback;
905: END IF;
906:
907: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.extractClassificationData-'||
908: xErrLoc);
909: raise ICX_POR_EXT_UTL.gException;
910: when others then
911: -- rollback;
912: ICX_POR_EXT_UTL.extRollback;
913:
908: xErrLoc);
909: raise ICX_POR_EXT_UTL.gException;
910: when others then
911: -- rollback;
912: ICX_POR_EXT_UTL.extRollback;
913:
914: IF (cClass%ISOPEN) THEN
915: CLOSE cClass;
916: END IF;
914: IF (cClass%ISOPEN) THEN
915: CLOSE cClass;
916: END IF;
917:
918: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.extractClassificationData-'||
919: xErrLoc||' '||SQLERRM);
920: raise ICX_POR_EXT_UTL.gException;
921: END extractClassificationData;
922:
916: END IF;
917:
918: ICX_POR_EXT_UTL.pushError('ICX_POR_EXT_CLASS.extractClassificationData-'||
919: xErrLoc||' '||SQLERRM);
920: raise ICX_POR_EXT_UTL.gException;
921: END extractClassificationData;
922:
923:
924: END ICX_POR_EXT_CLASS;