I am writing a postgres function where I have declared a variable called fruit.
$$
DECLARE
IN_fruit varchar;
sql;
BEGIN
IN_fruit := EXECUTE 'SELECT fruit FROM fruits WHERE id = 1'
How can I get this work in a way that the result returned from this query is stored in the variable IN_fruit, which I can use for later use in my main SQL query.