117: xErrLoc := 500;
118: FOR catRec IN CatIdCur(p_request_id)
119: LOOP
120: vCategoryId := catRec.catid;
121: vItemSourceCursor := DBMS_SQL.OPEN_CURSOR;
122: xErrLoc := 520;
123:
124: --Changes for populate_ctx_desc_indexes to not throw invalid ROWID exception
125: --vSqlString := 'SELECT rowid,rt_item_id,language FROM ICX_CAT_ITEMS_TLP '||
125: --vSqlString := 'SELECT rowid,rt_item_id,language FROM ICX_CAT_ITEMS_TLP '||
126: -- ' WHERE primary_category_id = :catid';
127: vSqlString := 'SELECT rowid,rt_item_id,language FROM ICX_CAT_EXT_ITEMS_TLP '||
128: ' WHERE rt_category_id = :catid';
129: DBMS_SQL.PARSE(vItemSourceCursor, vSqlString, DBMS_SQL.NATIVE);
130: DBMS_SQL.BIND_VARIABLE(vItemSourceCursor, ':catid', vCategoryId);
131: /*
132: IF (vCatTableExists = 1) THEN
133: --STO_CHECK: to get list of items affected by a category/descriptor change
126: -- ' WHERE primary_category_id = :catid';
127: vSqlString := 'SELECT rowid,rt_item_id,language FROM ICX_CAT_EXT_ITEMS_TLP '||
128: ' WHERE rt_category_id = :catid';
129: DBMS_SQL.PARSE(vItemSourceCursor, vSqlString, DBMS_SQL.NATIVE);
130: DBMS_SQL.BIND_VARIABLE(vItemSourceCursor, ':catid', vCategoryId);
131: /*
132: IF (vCatTableExists = 1) THEN
133: --STO_CHECK: to get list of items affected by a category/descriptor change
134: -- cant we just use the category items table...do we need
133: --STO_CHECK: to get list of items affected by a category/descriptor change
134: -- cant we just use the category items table...do we need
135: -- icx_por_c
136: vSqlString := 'SELECT rowid,rt_item_id,language FROM ICX_POR_C'||vCategoryId||'_TL';
137: DBMS_SQL.PARSE(vItemSourceCursor, vSqlString, DBMS_SQL.NATIVE);
138: ELSE
139: vSqlString := 'SELECT rowid,rt_item_id,language FROM ICX_POR_ITEMS_TL '||
140: ' WHERE primary_category_id = :catid)';
141: DBMS_SQL.PARSE(vItemSourceCursor, vSqlString, DBMS_SQL.NATIVE);
137: DBMS_SQL.PARSE(vItemSourceCursor, vSqlString, DBMS_SQL.NATIVE);
138: ELSE
139: vSqlString := 'SELECT rowid,rt_item_id,language FROM ICX_POR_ITEMS_TL '||
140: ' WHERE primary_category_id = :catid)';
141: DBMS_SQL.PARSE(vItemSourceCursor, vSqlString, DBMS_SQL.NATIVE);
142: DBMS_SQL.BIND_VARIABLE(vItemSourceCursor, ':catid', vCategoryId);
143: END IF;
144: */
145:
138: ELSE
139: vSqlString := 'SELECT rowid,rt_item_id,language FROM ICX_POR_ITEMS_TL '||
140: ' WHERE primary_category_id = :catid)';
141: DBMS_SQL.PARSE(vItemSourceCursor, vSqlString, DBMS_SQL.NATIVE);
142: DBMS_SQL.BIND_VARIABLE(vItemSourceCursor, ':catid', vCategoryId);
143: END IF;
144: */
145:
146: xErrLoc := 540;
146: xErrLoc := 540;
147: ICX_POR_CTX_DESC.populateCtxDescCatAtt(vCategoryId, vItemSourceCursor,'Y',
148: 'Y', NULL, 'ROWID');
149: xErrLoc:=560;
150: DBMS_SQL.CLOSE_CURSOR(vItemSourceCursor);
151: xErrLoc:=580;
152: END LOOP;
153:
154: xErrLoc := 600;
173: EXCEPTION
174: WHEN OTHERS THEN
175: ROLLBACK;
176:
177: IF(DBMS_SQL.IS_OPEN(vItemSourceCursor)) THEN
178: DBMS_SQL.CLOSE_CURSOR(vItemSourceCursor);
179: END IF;
180:
181: RAISE_APPLICATION_ERROR
174: WHEN OTHERS THEN
175: ROLLBACK;
176:
177: IF(DBMS_SQL.IS_OPEN(vItemSourceCursor)) THEN
178: DBMS_SQL.CLOSE_CURSOR(vItemSourceCursor);
179: END IF;
180:
181: RAISE_APPLICATION_ERROR
182: (-20000, 'Exception at ICX_POR_SCHEMA_UPLOAD.populate_ctx_desc_indexes('||
753: xRebuildFlag VARCHAR2(1) := 'N';
754:
755: xContinue BOOLEAN := TRUE;
756: xCommitSize INTEGER := 2500;
757: xLangArray DBMS_SQL.VARCHAR2_TABLE;
758: CURSOR translateLangCsr IS
759: SELECT language
760: FROM icx_cat_categories_tl
761: WHERE rt_category_id = p_category_id
3007: --fail with exception 'ORA-00957:duplicate column name'
3008: CURSOR deleted_descriptors_csr IS
3009: SELECT distinct rt_category_id, stored_in_table, stored_in_column
3010: from icx_cat_deleted_attributes order by stored_in_table, rt_category_id;
3011: vRtCategoryIds dbms_sql.number_table;
3012: --Bug#3072827 vRtDescriptorIds dbms_sql.number_table;
3013: vStoredInColumns dbms_sql.varchar2_table;
3014: vStoredInTables dbms_sql.varchar2_table;
3015: xErrLoc NUMBER := 100;
3008: CURSOR deleted_descriptors_csr IS
3009: SELECT distinct rt_category_id, stored_in_table, stored_in_column
3010: from icx_cat_deleted_attributes order by stored_in_table, rt_category_id;
3011: vRtCategoryIds dbms_sql.number_table;
3012: --Bug#3072827 vRtDescriptorIds dbms_sql.number_table;
3013: vStoredInColumns dbms_sql.varchar2_table;
3014: vStoredInTables dbms_sql.varchar2_table;
3015: xErrLoc NUMBER := 100;
3016: update_tlp_sql_string VARCHAR2(4000) := null;
3009: SELECT distinct rt_category_id, stored_in_table, stored_in_column
3010: from icx_cat_deleted_attributes order by stored_in_table, rt_category_id;
3011: vRtCategoryIds dbms_sql.number_table;
3012: --Bug#3072827 vRtDescriptorIds dbms_sql.number_table;
3013: vStoredInColumns dbms_sql.varchar2_table;
3014: vStoredInTables dbms_sql.varchar2_table;
3015: xErrLoc NUMBER := 100;
3016: update_tlp_sql_string VARCHAR2(4000) := null;
3017: update_tlp_set_string VARCHAR2(4000) := null;
3010: from icx_cat_deleted_attributes order by stored_in_table, rt_category_id;
3011: vRtCategoryIds dbms_sql.number_table;
3012: --Bug#3072827 vRtDescriptorIds dbms_sql.number_table;
3013: vStoredInColumns dbms_sql.varchar2_table;
3014: vStoredInTables dbms_sql.varchar2_table;
3015: xErrLoc NUMBER := 100;
3016: update_tlp_sql_string VARCHAR2(4000) := null;
3017: update_tlp_set_string VARCHAR2(4000) := null;
3018: update_tlp_value_string VARCHAR2(4000) := null;
3089: -- Category changed in the list, means a new category is read, so
3090: -- process the category and its descriptors...
3091: -- process even when end of list is reached..
3092: IF (i = vRtCategoryIds.COUNT OR nextCategoryId <> vRtCategoryIds(i)) THEN
3093: v_cursor_id := DBMS_SQL.open_cursor;
3094:
3095: -- Process the category read.
3096: xErrLoc := 700;
3097:
3098: IF vRtCategoryIds(i) = 0 THEN
3099: update_tlp_sql_string := 'UPDATE ICX_CAT_ITEMS_TLP SET ';
3100: update_tlp_sql_string := update_tlp_sql_string ||' ('||update_tlp_set_string||' ) = (select ' || update_tlp_value_string|| ' from dual) where primary_category_id = :cat_id';
3101: xErrLoc := 750;
3102: DBMS_SQL.parse(v_cursor_id, update_tlp_sql_string, dbms_sql.native);
3103: -- Reset the values for reading next set of Base attributes for
3104: -- the next category
3105: numBaseAttribs := 0;
3106: update_tlp_set_string := null;
3109: -- Process the category attributes just read for this category
3110: update_exttlp_sql_string := 'UPDATE ICX_CAT_EXT_ITEMS_TLP SET ';
3111: update_exttlp_sql_string := update_exttlp_sql_string||' ('||update_exttlp_set_string||' ) = (select ' || update_exttlp_value_string|| ' from dual) where rt_category_id = :cat_id';
3112: xErrLoc := 750;
3113: DBMS_SQL.parse(v_cursor_id, update_exttlp_sql_string, dbms_sql.native);
3114: -- Reset the values for reading next set of category attributes for
3115: -- the next category
3116: numCatAttribs := 0;
3117: update_exttlp_set_string := null;
3118: update_exttlp_value_string := null;
3119: END IF;
3120:
3121: xErrLoc := 800;
3122: DBMS_SQL.bind_variable(v_cursor_id, ':cat_id', vRtCategoryIds(i));
3123: result := DBMS_SQL.execute(v_cursor_id);
3124: DBMS_SQL.close_cursor(v_cursor_id);
3125:
3126: END IF;
3119: END IF;
3120:
3121: xErrLoc := 800;
3122: DBMS_SQL.bind_variable(v_cursor_id, ':cat_id', vRtCategoryIds(i));
3123: result := DBMS_SQL.execute(v_cursor_id);
3124: DBMS_SQL.close_cursor(v_cursor_id);
3125:
3126: END IF;
3127:
3120:
3121: xErrLoc := 800;
3122: DBMS_SQL.bind_variable(v_cursor_id, ':cat_id', vRtCategoryIds(i));
3123: result := DBMS_SQL.execute(v_cursor_id);
3124: DBMS_SQL.close_cursor(v_cursor_id);
3125:
3126: END IF;
3127:
3128: xErrLoc := 600+i;