INSERT INTO FUNCTIONALITY_PRINTERS (ID_INTERNAL, FUNCTIONALITY, KEY_PRINTERS) VALUES (1, 'markSheet','markSheet.printers.graduacao');
SELECT @GRADUATION_UNIT_ID:=KEY_UNIT FROM ADMINISTRATIVE_OFFICE WHERE ADMINISTRATIVE_OFFICE_TYPE = 'DEGREE';
INSERT INTO UNIT_FUNCTIONALITY_PRINTERS (KEY_UNIT,KEY_FUNCTIONALITY_PRINTERS) VALUES (@GRADUATION_UNIT_ID,1);

INSERT INTO FUNCTIONALITY_PRINTERS (ID_INTERNAL, FUNCTIONALITY, KEY_PRINTERS) VALUES (2, 'markSheet','markSheet.printers.posGraduacao');
SELECT @POST_GRADUATION_UNIT_ID:=KEY_UNIT FROM ADMINISTRATIVE_OFFICE WHERE ADMINISTRATIVE_OFFICE_TYPE = 'MASTER_DEGREE';

INSERT INTO UNIT_FUNCTIONALITY_PRINTERS (KEY_UNIT,KEY_FUNCTIONALITY_PRINTERS) VALUES (@POST_GRADUATION_UNIT_ID,2);

UPDATE FUNCTIONALITY_PRINTERS SET KEY_ROOT_DOMAIN_OBJECT = 1;
UPDATE FUNCTIONALITY_PRINTERS SET OID_ROOT_DOMAIN_OBJECT = (SELECT OID FROM ROOT_DOMAIN_OBJECT);
select @xpto:=FF$DOMAIN_CLASS_INFO.DOMAIN_CLASS_ID from FF$DOMAIN_CLASS_INFO where FF$DOMAIN_CLASS_INFO.DOMAIN_CLASS_NAME like '%FunctionalityPrinters';
UPDATE FUNCTIONALITY_PRINTERS SET OID = (@xpto << 32) + ID_INTERNAL;
UPDATE UNIT_FUNCTIONALITY_PRINTERS INNER JOIN PARTY ON PARTY.ID_INTERNAL = UNIT_FUNCTIONALITY_PRINTERS.KEY_UNIT SET UNIT_FUNCTIONALITY_PRINTERS.OID_UNIT = PARTY.OID;
UPDATE UNIT_FUNCTIONALITY_PRINTERS INNER JOIN FUNCTIONALITY_PRINTERS ON FUNCTIONALITY_PRINTERS.ID_INTERNAL = UNIT_FUNCTIONALITY_PRINTERS.KEY_FUNCTIONALITY_PRINTERS SET UNIT_FUNCTIONALITY_PRINTERS.OID_FUNCTIONALITY_PRINTERS = FUNCTIONALITY_PRINTERS.OID;
