alter table PARTY add column CLASSIFICATION varchar(80) default '';

insert into PARTY_TYPE (TYPE, KEY_ROOT_DOMAIN_OBJECT) values ('ADMINISTRATIVE_OFFICE_UNIT', 1);

select concat('update PARTY set PARTY.KEY_PARTY_TYPE=' , PARTY_TYPE.ID_INTERNAL , ' where PARTY.KEY_PARTY_TYPE is not null and PARTY.KEY_PARTY_TYPE in (select PARTY_TYPE.ID_INTERNAL from PARTY_TYPE where PARTY_TYPE.TYPE = \"DIRECTIVE_COUNCIL_TAGUSPARK\");') as "" from PARTY_TYPE where PARTY_TYPE.TYPE = 'DIRECTIVE_COUNCIL';
select concat('update PARTY set PARTY.KEY_PARTY_TYPE=' , PARTY_TYPE.ID_INTERNAL , ' where PARTY.KEY_PARTY_TYPE is not null and PARTY.KEY_PARTY_TYPE in (select PARTY_TYPE.ID_INTERNAL from PARTY_TYPE where PARTY_TYPE.TYPE = \"EXECUTIVE_DIRECTION_TAGUSPARK\");') as "" from PARTY_TYPE where PARTY_TYPE.TYPE = 'EXECUTIVE_DIRECTION';
select concat('update PARTY set PARTY.KEY_PARTY_TYPE=' , PARTY_TYPE.ID_INTERNAL , ' where PARTY.KEY_ADMINISTRATIVE_OFFICE is not null;') as "" from PARTY_TYPE where PARTY_TYPE.TYPE = 'ADMINISTRATIVE_OFFICE_UNIT';

update PARTY set PARTY.KEY_PARTY_TYPE = NULL where PARTY.KEY_PARTY_TYPE is not null and PARTY.KEY_PARTY_TYPE in (select PARTY_TYPE.ID_INTERNAL from PARTY_TYPE where PARTY_TYPE.TYPE = 'EXTERNAL_INSTITUTION');
update PARTY set PARTY.KEY_PARTY_TYPE = NULL where PARTY.KEY_PARTY_TYPE is not null and PARTY.KEY_PARTY_TYPE in (select PARTY_TYPE.ID_INTERNAL from PARTY_TYPE where PARTY_TYPE.TYPE = 'TAGUSPARK');
update PARTY set PARTY.KEY_PARTY_TYPE = NULL where PARTY.KEY_PARTY_TYPE is not null and PARTY.KEY_PARTY_TYPE in (select PARTY_TYPE.ID_INTERNAL from PARTY_TYPE where PARTY_TYPE.TYPE = 'AUTONOMOUS_SECTION');
update PARTY set PARTY.KEY_PARTY_TYPE = NULL where PARTY.KEY_PARTY_TYPE is not null and PARTY.KEY_PARTY_TYPE in (select PARTY_TYPE.ID_INTERNAL from PARTY_TYPE where PARTY_TYPE.TYPE = 'ACADEMIC_UNIT');
update PARTY set PARTY.KEY_PARTY_TYPE = NULL where PARTY.KEY_PARTY_TYPE is not null and PARTY.KEY_PARTY_TYPE in (select PARTY_TYPE.ID_INTERNAL from PARTY_TYPE where PARTY_TYPE.TYPE = 'SERVICES');

update PARTY set PARTY.CLASSIFICATION='CENTRAL_ORG', PARTY.KEY_PARTY_TYPE = NULL where PARTY.KEY_PARTY_TYPE is not null and PARTY.KEY_PARTY_TYPE in (select PARTY_TYPE.ID_INTERNAL from PARTY_TYPE where PARTY_TYPE.TYPE like 'CENTRAL_ORG');
update PARTY set PARTY.CLASSIFICATION='DIRECTIVE_COUNCIL', PARTY.KEY_PARTY_TYPE = NULL where PARTY.KEY_PARTY_TYPE is not null and PARTY.KEY_PARTY_TYPE in (select PARTY_TYPE.ID_INTERNAL from PARTY_TYPE where PARTY_TYPE.TYPE like 'DIRECTIVE_COUNCIL');
update PARTY set PARTY.CLASSIFICATION='EXECUTIVE_DIRECTION', PARTY.KEY_PARTY_TYPE = NULL where PARTY.KEY_PARTY_TYPE is not null and PARTY.KEY_PARTY_TYPE in (select PARTY_TYPE.ID_INTERNAL from PARTY_TYPE where PARTY_TYPE.TYPE like 'EXECUTIVE_DIRECTION');
update PARTY set PARTY.CLASSIFICATION='FINANCIER_DIRECTION', PARTY.KEY_PARTY_TYPE = NULL where PARTY.KEY_PARTY_TYPE is not null and PARTY.KEY_PARTY_TYPE in (select PARTY_TYPE.ID_INTERNAL from PARTY_TYPE where PARTY_TYPE.TYPE like 'FINANCIER_DIRECTION');
update PARTY set PARTY.CLASSIFICATION='TECHNIQUE_DIRECTION', PARTY.KEY_PARTY_TYPE = NULL where PARTY.KEY_PARTY_TYPE is not null and PARTY.KEY_PARTY_TYPE in (select PARTY_TYPE.ID_INTERNAL from PARTY_TYPE where PARTY_TYPE.TYPE like 'TECHNIQUE_DIRECTION');
update PARTY set PARTY.CLASSIFICATION='ACADEMIC_SERVICES_SUPERVISION', PARTY.KEY_PARTY_TYPE = NULL where PARTY.KEY_PARTY_TYPE is not null and PARTY.KEY_PARTY_TYPE in (select PARTY_TYPE.ID_INTERNAL from PARTY_TYPE where PARTY_TYPE.TYPE like 'ACADEMIC_SERVICES_SUPERVISION');
update PARTY set PARTY.CLASSIFICATION='OUT_RELATION_SERVICES_SUPERVISION', PARTY.KEY_PARTY_TYPE = NULL where PARTY.KEY_PARTY_TYPE is not null and PARTY.KEY_PARTY_TYPE in (select PARTY_TYPE.ID_INTERNAL from PARTY_TYPE where PARTY_TYPE.TYPE like 'OUT_RELATION_SERVICES_SUPERVISION');
update PARTY set PARTY.CLASSIFICATION='SCIENTIFIC_PEDAGOGICAL_MANAGEMENT_RESOURCES_SERVICES_SUPERVISION', PARTY.KEY_PARTY_TYPE = NULL where PARTY.KEY_PARTY_TYPE is not null and PARTY.KEY_PARTY_TYPE in (select PARTY_TYPE.ID_INTERNAL from PARTY_TYPE where PARTY_TYPE.TYPE like 'SCIENTIFIC_PEDAGOGICAL_MANAGEMENT_RESOURCES_SERVICES_SUPERVISION');
update PARTY set PARTY.CLASSIFICATION='DEGREE_COORDINATION', PARTY.KEY_PARTY_TYPE = NULL where PARTY.KEY_PARTY_TYPE is not null and PARTY.KEY_PARTY_TYPE in (select PARTY_TYPE.ID_INTERNAL from PARTY_TYPE where PARTY_TYPE.TYPE like 'DEGREE_COORDINATION');
update PARTY set PARTY.CLASSIFICATION='SCIENCE_INFRASTRUCTURE', PARTY.KEY_PARTY_TYPE = NULL where PARTY.KEY_PARTY_TYPE is not null and PARTY.KEY_PARTY_TYPE in (select PARTY_TYPE.ID_INTERNAL from PARTY_TYPE where PARTY_TYPE.TYPE like 'SCIENCE_INFRASTRUCTURE');
update PARTY set PARTY.CLASSIFICATION='INFORMATION_TECHNOLOGY_LABORATORY', PARTY.KEY_PARTY_TYPE = NULL where PARTY.KEY_PARTY_TYPE is not null and PARTY.KEY_PARTY_TYPE in (select PARTY_TYPE.ID_INTERNAL from PARTY_TYPE where PARTY_TYPE.TYPE like 'INFORMATION_TECHNOLOGY_LABORATORY');
update PARTY set PARTY.CLASSIFICATION='ASSOCIATED_LABORATORY', PARTY.KEY_PARTY_TYPE = NULL where PARTY.KEY_PARTY_TYPE is not null and PARTY.KEY_PARTY_TYPE in (select PARTY_TYPE.ID_INTERNAL from PARTY_TYPE where PARTY_TYPE.TYPE like 'ASSOCIATED_LABORATORY');
update PARTY set PARTY.CLASSIFICATION='EXTRA_CURRICULAR_ACTIVITIES', PARTY.KEY_PARTY_TYPE = NULL where PARTY.KEY_PARTY_TYPE is not null and PARTY.KEY_PARTY_TYPE in (select PARTY_TYPE.ID_INTERNAL from PARTY_TYPE where PARTY_TYPE.TYPE like 'EXTRA_CURRICULAR_ACTIVITIES');
update PARTY set PARTY.CLASSIFICATION='PARTICIPATED_IST_INSTITUTION', PARTY.KEY_PARTY_TYPE = NULL where PARTY.KEY_PARTY_TYPE is not null and PARTY.KEY_PARTY_TYPE in (select PARTY_TYPE.ID_INTERNAL from PARTY_TYPE where PARTY_TYPE.TYPE like 'PARTICIPATED_IST_INSTITUTION');
update PARTY set PARTY.CLASSIFICATION='DIVERSE_CONSTRUCTION_BUILDING', PARTY.KEY_PARTY_TYPE = NULL where PARTY.KEY_PARTY_TYPE is not null and PARTY.KEY_PARTY_TYPE in (select PARTY_TYPE.ID_INTERNAL from PARTY_TYPE where PARTY_TYPE.TYPE like 'DIVERSE_CONSTRUCTION_BUILDING');
update PARTY set PARTY.CLASSIFICATION='RESEARCH_UNIT', PARTY.KEY_PARTY_TYPE = NULL where PARTY.KEY_PARTY_TYPE is not null and PARTY.KEY_PARTY_TYPE in (select PARTY_TYPE.ID_INTERNAL from PARTY_TYPE where PARTY_TYPE.TYPE like 'RESEARCH_UNIT');
update PARTY set PARTY.CLASSIFICATION='OUT', PARTY.KEY_PARTY_TYPE = NULL where PARTY.KEY_PARTY_TYPE is not null and PARTY.KEY_PARTY_TYPE in (select PARTY_TYPE.ID_INTERNAL from PARTY_TYPE where PARTY_TYPE.TYPE like 'OUT');

update PARTY set PARTY.KEY_PARTY_TYPE = NULL where PARTY.KEY_PARTY_TYPE is not null and PARTY.KEY_PARTY_TYPE in (select PARTY_TYPE.ID_INTERNAL from PARTY_TYPE where PARTY_TYPE.TYPE like 'UNKNOWN');