I create a function that returns the value of a field when the id is given :
CREATE OR REPLACE FUNCTION get_dcteam(id int) RETURNS text
AS $$
#print_strict_params on
DECLARE
dc_team text;
BEGIN
SELECT monitoring_table.dc_team INTO STRICT dc_team
FROM monitoring_table WHERE monitoring_table.id = get_dcteam.id;
RETURN dc_team;
END
$$ LANGUAGE plpgsql;
I call it this way :
select * from get_dcteam((select id from monitoring_table where id=30))
What I want to do is call the function dynamically. I don't want to precise a known id(given value in parameter) but any existing value in my table. The result of this query I will use it in a trigger.
I'm a newbie and I'm struggling to learn dynamic SQL.
Your help would be precious.
Best regards.