[Home] [Help]
1233: p_seq_num IN NUMBER) IS
1234:
1235: CURSOR c_delete IS
1236: (select sr_item_pk
1237: from msd_item_list_price
1238: where instance = p_instance_id
1239: MINUS
1240: select sr_item_pk
1241: from msd_st_item_list_price
1240: select sr_item_pk
1241: from msd_st_item_list_price
1242: where instance = p_instance_id);
1243:
1244: TYPE sr_item_pk_tab is table of msd_item_list_price.sr_item_pk%TYPE;
1245:
1246: a_sr_item_pk SR_ITEM_PK_TAB;
1247:
1248:
1253: CLOSE c_delete;
1254:
1255: IF (a_sr_item_pk.exists(1)) THEN
1256: FORALL i IN a_sr_item_pk.FIRST..a_sr_item_pk.LAST
1257: DELETE FROM msd_item_list_price
1258: WHERE sr_item_pk = a_sr_item_pk(i) and instance = p_instance_id;
1259: /*
1260: FORALL j IN a_sr_item_pk.FIRST..a_sr_item_pk.LAST
1261: INSERT INTO msd_deleted_item_list_price(instance, sr_item_pk, created_by_refresh_num,
1300:
1301: CURSOR c_fact_rows (p_item_pk VARCHAR2) IS
1302: select sr_item_pk, item, list_price, avg_discount, base_uom,
1303: item_type_id, forecast_type_id
1304: from msd_item_list_price
1305: where instance = p_instance_id and sr_item_pk = p_item_pk;
1306:
1307: l_item VARCHAR2(240);
1308: l_list_price NUMBER;
1326:
1327: /* If this row doesn't exist in fact table then insert */
1328: IF (l_item_pk is null) THEN
1329:
1330: INSERT INTO msd_item_list_price( instance, item, list_price,
1331: avg_discount, base_uom,
1332: sr_item_pk, item_type_id, forecast_type_id,
1333: action_code, created_by_refresh_num, last_refresh_num,
1334: last_update_date, last_updated_by,
1354: (nvl(rec_st_rows.item_type_id,-9999) <> nvl(l_item_type_id,-9999)) OR
1355: (nvl(rec_st_rows.forecast_type_id,-9999) <> nvl(l_forecast_type_id,-9999)) ) THEN
1356: /* If this row has been modified */
1357:
1358: UPDATE msd_item_list_price
1359: SET item = rec_st_rows.item,
1360: list_price = rec_st_rows.list_price,
1361: avg_discount = rec_st_rows.avg_discount,
1362: base_uom = rec_st_rows.base_uom,