766: where mtsil.partner_type = 2
767: and mtsil.sr_company_id = -1
768: group by mtsil.tp_site_id, mtsil.sr_instance_id
769: ) CUST_SITE_VIEW,
770: msc_system_items msi
771: where md.plan_id = p_old_plan_id
772: and md.origination_type in (6,30)
773: and (md.demand_id, md.sr_instance_id) in (
774: (
1054: where mtsil.partner_type = 2
1055: and mtsil.sr_company_id = -1
1056: group by mtsil.sr_instance_id, mtsil.tp_site_id
1057: ) CUST_SITE_VIEW,
1058: msc_system_items msi
1059: where md.plan_id = p_old_plan_id
1060: and md.origination_type in (6,30)
1061: and (md.demand_id, md.sr_instance_id) in (
1062: select max (md1.demand_id),