SELECT 
CONCAT('INSERT INTO PARTY_CONTACT (KEY_ROOT_DOMAIN_OBJECT, OJB_CONCRETE_CLASS, VISIBLE, DEFAULT_CONTACT, TYPE, KEY_PARTY, NUMBER) VALUES (1, "net.sourceforge.fenixedu.domain.contacts.Phone", 1, 1, "PERSONAL", ', PARTY.ID_INTERNAL, ', "', PARTY.PHONE, '");') AS ""
FROM PARTY WHERE PARTY.PHONE IS NOT NULL AND LENGTH(PARTY.PHONE) > 0 AND PARTY.PHONE REGEXP '[0-9]+';

SELECT 
CONCAT('INSERT INTO PARTY_CONTACT (KEY_ROOT_DOMAIN_OBJECT, OJB_CONCRETE_CLASS, VISIBLE, DEFAULT_CONTACT, TYPE, KEY_PARTY, NUMBER) VALUES (1, "net.sourceforge.fenixedu.domain.contacts.MobilePhone", 1, 1, "PERSONAL", ', PARTY.ID_INTERNAL, ', "', PARTY.MOBILE, '");') AS ""
FROM PARTY WHERE PARTY.MOBILE IS NOT NULL AND LENGTH(PARTY.MOBILE) > 0 AND PARTY.MOBILE REGEXP '[0-9]+';

SELECT 
CONCAT('INSERT INTO PARTY_CONTACT (KEY_ROOT_DOMAIN_OBJECT, OJB_CONCRETE_CLASS, VISIBLE, DEFAULT_CONTACT, TYPE, KEY_PARTY, NUMBER) VALUES (1, "net.sourceforge.fenixedu.domain.contacts.Phone", 1, 0, "WORK", ', PARTY.ID_INTERNAL, ', "', PARTY.WORK_PHONE, '");') AS ""
FROM PARTY WHERE PARTY.WORK_PHONE IS NOT NULL AND LENGTH(PARTY.WORK_PHONE) > 0 AND PARTY.PHONE REGEXP '[0-9]+';
