CREATE FUNCTION getProfesseur(idp integer) RETURNS void AS $$
BEGIN
EXECUTE 'SELECT * FROM professeur WHERE prof_id=' || idp;
END; $$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION getProfesseurBis(idp integer) RETURNS Professeur AS $$
DECLARE
prof Professeur;
BEGIN
EXECUTE 'SELECT * FROM professeur WHERE prof_id=' || idp INTO prof;
RETURN prof;
END; $$ LANGUAGE plpgsql;
=> SELECT getProfesseur(1);
getprofesseur
---------------------------
(1 row)
=> SELECT getProfesseurBis(1);
getprofesseurbis
---------------------------
(1,Amanton,Laurent,,,MCF)
(1 row)