 select concat('INSERT INTO PERSON_ROLE (KEY_PERSON,KEY_ROLE) VALUES(',T.KEY_PERSON,',',R.ID_INTERNAL,');') 
 as "" from TEACHER T,ROLE R WHERE R.ROLE_TYPE = 'DEPARTMENT_MEMBER' AND T.KEY_PERSON NOT IN (SELECT PR.KEY_PERSON FROM PERSON_ROLE PR WHERE PR.KEY_ROLE = R.ID_INTERNAL);