451: ,p_party_hist_tbl IN OUT NOCOPY csi_diagnostics_pkg.T_NUM
452: ) IS
453: BEGIN
454: FOR i in p_party_tbl.FIRST .. p_party_tbl.LAST LOOP
455: select CSI_I_PARTIES_H_S.nextval
456: into p_party_hist_tbl(i) from dual;
457: --
458: p_party_rec_tab.instance_party_id(i) := p_party_tbl(i).instance_party_id;
459: p_party_rec_tab.instance_id(i) := p_party_tbl(i).instance_id;
2063: --
2064: -- Insert into History
2065: log('Before inserting into Parties history..');
2066: FORALL i in 1 .. l_party_rec_tab.instance_party_id.count
2067: INSERT INTO CSI_I_PARTIES_H(
2068: INSTANCE_PARTY_HISTORY_ID,
2069: INSTANCE_PARTY_ID,
2070: TRANSACTION_ID,
2071: NEW_PARTY_SOURCE_TABLE,
9603: DELETE FROM CSI_I_VERSION_LABELS WHERE instance_id = l_instance_tbl(j);
9604: FORALL j in l_txn_tbl.FIRST .. l_txn_tbl.LAST
9605: DELETE FROM CSI_ITEM_INSTANCES_H WHERE transaction_id = l_txn_tbl(j);
9606: FORALL j in l_txn_tbl.FIRST .. l_txn_tbl.LAST
9607: DELETE FROM CSI_I_PARTIES_H WHERE transaction_id = l_txn_tbl(j);
9608: FORALL j in l_txn_tbl.FIRST .. l_txn_tbl.LAST
9609: DELETE FROM CSI_I_VERSION_LABELS_H WHERE transaction_id = l_txn_tbl(j);
9610: FORALL j in l_txn_tbl.FIRST .. l_txn_tbl.LAST
9611: DELETE FROM CSI_TRANSACTIONS WHERE transaction_id = l_txn_tbl(j);
10230: DELETE FROM CSI_I_VERSION_LABELS WHERE instance_id = l_del_inst_tbl(j);
10231: FORALL j in l_del_txn_tbl.FIRST .. l_del_txn_tbl.LAST
10232: DELETE FROM CSI_ITEM_INSTANCES_H WHERE transaction_id = l_del_txn_tbl(j);
10233: FORALL j in l_del_txn_tbl.FIRST .. l_del_txn_tbl.LAST
10234: DELETE FROM CSI_I_PARTIES_H WHERE transaction_id = l_del_txn_tbl(j);
10235: FORALL j in l_del_txn_tbl.FIRST .. l_del_txn_tbl.LAST
10236: DELETE FROM CSI_I_VERSION_LABELS_H WHERE transaction_id = l_del_txn_tbl(j);
10237: FORALL j in l_del_txn_tbl.FIRST .. l_del_txn_tbl.LAST
10238: DELETE FROM CSI_TRANSACTIONS WHERE transaction_id = l_del_txn_tbl(j);
10673: CURSOR PARTY_HIST_CUR IS
10674: select a.instance_party_history_id instance_party_history_id,a.instance_party_id instance_party_id,
10675: a.old_relationship_type_code old_rel_type,
10676: a.old_party_id old_party_id,a.new_party_id new_party_id
10677: from CSI_I_PARTIES_H a
10678: where a.old_relationship_type_code is not null
10679: and a.old_relationship_type_code <> 'OWNER'
10680: and a.new_relationship_type_code is not null
10681: and a.new_relationship_type_code = 'OWNER'
10685: where b.instance_id = (select c.instance_id from CSI_I_PARTIES c
10686: where c.instance_party_id = a.instance_party_id)
10687: and b.relationship_type_code = 'OWNER')
10688: and a.instance_party_history_id = (select max(instance_party_history_id)
10689: from CSI_I_PARTIES_H d
10690: where d.instance_party_id = a.instance_party_id);
10691: --
10692: TYPE NUMLIST IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
10693: l_inst_tbl NUMLIST;
10779: where instance_id = (select instance_id from CSI_I_PARTIES
10780: where instance_party_id = party_rec.instance_party_id)
10781: and relationship_type_code = 'OWNER';
10782: --
10783: Update CSI_I_PARTIES_H
10784: set new_relationship_type_code = party_rec.old_rel_type,
10785: new_party_id = party_rec.old_party_id
10786: where instance_party_history_id = party_rec.instance_party_history_id;
10787: --
12757: ||' into CSI_I_PARTIES '||SUBSTR(sqlerrm,1,1000);
12758: raise_application_error(-20000, v_err_msg );
12759: Raise;
12760: End;
12761: -- Insert into CSI_I_PARTIES_H
12762: Begin
12763: select CSI_I_PARTIES_H_S.nextval
12764: into v_ins_party_history_id
12765: from DUAL;
12759: Raise;
12760: End;
12761: -- Insert into CSI_I_PARTIES_H
12762: Begin
12763: select CSI_I_PARTIES_H_S.nextval
12764: into v_ins_party_history_id
12765: from DUAL;
12766: End;
12767: -- Insert into CSI_I_PARTIES_H
12763: select CSI_I_PARTIES_H_S.nextval
12764: into v_ins_party_history_id
12765: from DUAL;
12766: End;
12767: -- Insert into CSI_I_PARTIES_H
12768: Begin
12769: INSERT INTO CSI_I_PARTIES_H(
12770: INSTANCE_PARTY_HISTORY_ID
12771: ,INSTANCE_PARTY_ID
12765: from DUAL;
12766: End;
12767: -- Insert into CSI_I_PARTIES_H
12768: Begin
12769: INSERT INTO CSI_I_PARTIES_H(
12770: INSTANCE_PARTY_HISTORY_ID
12771: ,INSTANCE_PARTY_ID
12772: ,TRANSACTION_ID
12773: ,OLD_PARTY_SOURCE_TABLE
12822: );
12823: Exception
12824: when others then
12825: v_err_msg := 'Unable to Insert Item ID '||to_char(inventory_item_id_mig(i))
12826: ||' into CSI_I_PARTIES_H using the same Instance '||SUBSTR(sqlerrm,1,1000);
12827: raise_application_error(-20000, v_err_msg );
12828: Raise;
12829: End;
12830: ELSE -- Lot controlled item
13251: ||' into CSI_I_PARTIES '||SUBSTR(sqlerrm,1,1000);
13252: raise_application_error(-20000, v_err_msg );
13253: Raise;
13254: End;
13255: -- Insert into CSI_I_PARTIES_H
13256: Begin
13257: select CSI_I_PARTIES_H_S.nextval
13258: into v_ins_party_history_id
13259: from DUAL;
13253: Raise;
13254: End;
13255: -- Insert into CSI_I_PARTIES_H
13256: Begin
13257: select CSI_I_PARTIES_H_S.nextval
13258: into v_ins_party_history_id
13259: from DUAL;
13260: End;
13261: -- Insert into CSI_I_PARTIES_H
13257: select CSI_I_PARTIES_H_S.nextval
13258: into v_ins_party_history_id
13259: from DUAL;
13260: End;
13261: -- Insert into CSI_I_PARTIES_H
13262: Begin
13263: INSERT INTO CSI_I_PARTIES_H(
13264: INSTANCE_PARTY_HISTORY_ID
13265: ,INSTANCE_PARTY_ID
13259: from DUAL;
13260: End;
13261: -- Insert into CSI_I_PARTIES_H
13262: Begin
13263: INSERT INTO CSI_I_PARTIES_H(
13264: INSTANCE_PARTY_HISTORY_ID
13265: ,INSTANCE_PARTY_ID
13266: ,TRANSACTION_ID
13267: ,OLD_PARTY_SOURCE_TABLE
13316: );
13317: Exception
13318: when others then
13319: v_err_msg := 'Unable to Insert Item ID '||to_char(inventory_item_id_mig(i))
13320: ||' into CSI_I_PARTIES_H using the same Instance '||SUBSTR(sqlerrm,1,1000);
13321: raise_application_error(-20000, v_err_msg );
13322: Raise;
13323: End;
13324: END LOOP;
14300: ||' into CSI_I_PARTIES '||SUBSTR(sqlerrm,1,1000);
14301: raise_application_error(-20000, v_err_msg );
14302: Raise;
14303: End;
14304: -- Insert into CSI_I_PARTIES_H
14305: Begin
14306: select CSI_I_PARTIES_H_S.nextval
14307: into v_ins_party_history_id
14308: from DUAL;
14302: Raise;
14303: End;
14304: -- Insert into CSI_I_PARTIES_H
14305: Begin
14306: select CSI_I_PARTIES_H_S.nextval
14307: into v_ins_party_history_id
14308: from DUAL;
14309: End;
14310: -- Insert into CSI_I_PARTIES_H
14306: select CSI_I_PARTIES_H_S.nextval
14307: into v_ins_party_history_id
14308: from DUAL;
14309: End;
14310: -- Insert into CSI_I_PARTIES_H
14311: Begin
14312: INSERT INTO CSI_I_PARTIES_H(
14313: INSTANCE_PARTY_HISTORY_ID
14314: ,INSTANCE_PARTY_ID
14308: from DUAL;
14309: End;
14310: -- Insert into CSI_I_PARTIES_H
14311: Begin
14312: INSERT INTO CSI_I_PARTIES_H(
14313: INSTANCE_PARTY_HISTORY_ID
14314: ,INSTANCE_PARTY_ID
14315: ,TRANSACTION_ID
14316: ,OLD_PARTY_SOURCE_TABLE
14365: );
14366: Exception
14367: when others then
14368: v_err_msg := 'Unable to Insert Item ID '||to_char(inventory_item_id_mig(i))
14369: ||' into CSI_I_PARTIES_H using the same Instance '||SUBSTR(sqlerrm,1,1000);
14370: raise_application_error(-20000, v_err_msg );
14371: Raise;
14372: End;
14373: Exception
14911:
14912: DELETE FROM csi_item_instances_h
14913: WHERE instance_id=i.instance_id;
14914: --
14915: DELETE FROM csi_i_parties_h
14916: WHERE instance_party_id in (select instance_party_id from csi_i_parties
14917: WHERE instance_id=i.instance_id);
14918: --
14919: DELETE FROM csi_i_parties
15864: -- there may not be an account, but just in case
15865: DELETE FROM csi_ip_accounts
15866: WHERE instance_party_id = ip_rec.instance_party_id;
15867:
15868: DELETE FROM csi_i_parties_h
15869: WHERE instance_party_id = ip_rec.instance_party_id;
15870:
15871: END LOOP;
15872: