--order 502298
update customeractivities ca1
   set ca1.includenotactivityrelcharges = 'Y'
 where ca1.activity_id =
       (select min(ca.activity_id)
          from customeractivities ca, customer c
         where ca.customer_id = c.customer_id
           and not exists (select ca.activity_id
                  from customeractivities ca
                 where ca.includenotactivityrelcharges = 'Y'
                   and ca.customer_id = c.customer_id)
           and ca1.processbusinessunit_id =
               (select min(ca3.processbusinessunit_id)
                  from customeractivities ca3
                 where ca3.customer_id = ca1.customer_id
                   and ca3.activity_id = ca1.activity_id)
           and ca1.customer_id = ca.customer_id);

--order 502297
begin
execute immediate('drop index XIF25CUSTOMER');
exception when others then null;
end;
/


begin
execute immediate('alter table customer drop constraint cust_cluster_id');
exception when others then null;
end;
/

begin
execute immediate('alter table customer rename column cluster_id to oldcluster_id');
exception when others then null;
end;
/