alter table PARTY change column KEY_ROOT_DOMAIN_OBJECT_FOR_INSTITUTION_UNIT KEY_ROOT_DOMAIN_OBJECT_FOR_INSTITUTION_UNIT int(11) default null;
alter table PARTY change column KEY_ROOT_DOMAIN_OBJECT_FOR_EXTERNAL_INSTITUTION_UNIT KEY_ROOT_DOMAIN_OBJECT_FOR_EXTERNAL_INSTITUTION_UNIT int(11) default null;
alter table PARTY change column KEY_ROOT_DOMAIN_OBJECT_FOR_EARTH_UNIT KEY_ROOT_DOMAIN_OBJECT_FOR_EARTH_UNIT int(11) default null;

update PARTY set KEY_ROOT_DOMAIN_OBJECT_FOR_INSTITUTION_UNIT = null;
update PARTY set KEY_ROOT_DOMAIN_OBJECT_FOR_EXTERNAL_INSTITUTION_UNIT = null;
update PARTY set KEY_ROOT_DOMAIN_OBJECT_FOR_EARTH_UNIT = null;

update PARTY set KEY_ROOT_DOMAIN_OBJECT_FOR_INSTITUTION_UNIT = 1 where ID_INTERNAL in (select KEY_INSTITUTION_UNIT from ROOT_DOMAIN_OBJECT);
update PARTY set KEY_ROOT_DOMAIN_OBJECT_FOR_EXTERNAL_INSTITUTION_UNIT = 1 where ID_INTERNAL in (select KEY_EXTERNAL_INSTITUTION_UNIT from ROOT_DOMAIN_OBJECT);
update PARTY set KEY_ROOT_DOMAIN_OBJECT_FOR_EARTH_UNIT = 1 where ID_INTERNAL in (select KEY_EARTH_UNIT from ROOT_DOMAIN_OBJECT); 

