844: CONNECT BY PRIOR parent_catalog_group_id = item_catalog_group_id
845: START WITH item_catalog_group_id = p_new_catalog_group_id));
846:
847: /* Fix for Bug 10404086- If there are no recs in ego_mtl_sy_items_ext_b ,
848: do not run delete on ego_mtl_sy_items_ext_tl.*/
849: IF(SQL%ROWCOUNT > 0) THEN
850: DELETE ego_mtl_sy_items_ext_tl extl
851: WHERE inventory_item_id = p_inventory_item_id
852: AND organization_id IN (SELECT organization_id FROM mtl_parameters WHERE master_organization_id=p_organization_id) /* Changed WHERE clause for the Bug 9094912 */
846:
847: /* Fix for Bug 10404086- If there are no recs in ego_mtl_sy_items_ext_b ,
848: do not run delete on ego_mtl_sy_items_ext_tl.*/
849: IF(SQL%ROWCOUNT > 0) THEN
850: DELETE ego_mtl_sy_items_ext_tl extl
851: WHERE inventory_item_id = p_inventory_item_id
852: AND organization_id IN (SELECT organization_id FROM mtl_parameters WHERE master_organization_id=p_organization_id) /* Changed WHERE clause for the Bug 9094912 */
853: AND EXISTS (SELECT NULL
854: FROM ego_obj_attr_grp_assocs_v
865: (SELECT to_char(item_catalog_group_id)
866: FROM mtl_item_catalog_groups_b
867: CONNECT BY PRIOR parent_catalog_group_id = item_catalog_group_id
868: START WITH item_catalog_group_id = p_new_catalog_group_id));
869: End If; /* Fix for bug 10404086 - end of if for delete on ego_mtl_sy_items_ext_tl */
870:
871: --Update valid AG to point to new catalog group
872: UPDATE ego_mtl_sy_items_ext_b
873: SET item_catalog_group_id = p_new_catalog_group_id
878: WHERE inventory_item_id = p_inventory_item_id
879: AND organization_id IN (SELECT organization_id FROM mtl_parameters WHERE master_organization_id=p_organization_id); /* Changed WHERE clause for the Bug 9094912 */
880:
881: /* Fix for Bug 10404086- If there are no recs in ego_mtl_sy_items_ext_b ,
882: do not run update on ego_mtl_sy_items_ext_tl.*/
883: IF(SQL%ROWCOUNT > 0) THEN
884: UPDATE ego_mtl_sy_items_ext_tl
885: SET item_catalog_group_id = p_new_catalog_group_id
886: WHERE inventory_item_id = p_inventory_item_id
880:
881: /* Fix for Bug 10404086- If there are no recs in ego_mtl_sy_items_ext_b ,
882: do not run update on ego_mtl_sy_items_ext_tl.*/
883: IF(SQL%ROWCOUNT > 0) THEN
884: UPDATE ego_mtl_sy_items_ext_tl
885: SET item_catalog_group_id = p_new_catalog_group_id
886: WHERE inventory_item_id = p_inventory_item_id
887: AND organization_id IN (SELECT organization_id FROM mtl_parameters WHERE master_organization_id=p_organization_id); /* Changed WHERE clause for the Bug 9094912 */
888: End If; /* Fix for bug 10404086 - end of if for update on ego_mtl_sy_items_ext_tl */
884: UPDATE ego_mtl_sy_items_ext_tl
885: SET item_catalog_group_id = p_new_catalog_group_id
886: WHERE inventory_item_id = p_inventory_item_id
887: AND organization_id IN (SELECT organization_id FROM mtl_parameters WHERE master_organization_id=p_organization_id); /* Changed WHERE clause for the Bug 9094912 */
888: End If; /* Fix for bug 10404086 - end of if for update on ego_mtl_sy_items_ext_tl */
889:
890: --Delete attachments which doesnt fall under new catalog hierarchy.
891: DELETE fnd_attached_documents docs
892: WHERE pk2_value = to_char(p_inventory_item_id)