Let's see if someone can help me I have a table with id and a name, like this: id | first name 1 | Charles 2 | Pedro 3 | Juan and I want to create a function that by entering by parameter the id check me and I return the name of the id if the id is not in the query will launch me a message that is not. create function checkid (idnen integer) returns integer as $$ declare business name.children.nom% type; begin if (idnen in (select nom from nen where id = idnen) then name = (select nom from nen where id = idnen); else raise notice 'is not this id'; end if; return name; end; $$ language plpgsql;