title: Call a FUNCTION from inside a PROCEDURE in PostgreSQL
body: <p>Right now, we are migrating a stored procedure from SQL Server to Postgres.</p>
  <p>We have a procedure which does some write operations and after that It will call a list function to list all the data currently existing.</p>
  <pre><code>create or replace procedure public.tree_create()
      language plpgsql
  as
  $$
  BEGIN
     /* Insertion code goes here. */
  
      /* return result. */
      select * from public.tree_list();
  END;
  $$;
  </code></pre>
  <p>This will throw error</p>
  <blockquote>
  <p>[42601] ERROR: query has no destination for result data Hint: If you want to discard the results of a SELECT, use PERFORM instead. Where: PL/pgSQL function public.tree_create() line 4 at SQL statement</p>
  </blockquote>
  <p>So how can we return data by calling the function. FYI: The function is working fine and when we call it using <code>select * from list_tree()</code> It will returns the data.</p>
  <p>So how exactly can we call FUNCTION inside STORED PROCEDURE to return results? Or is there any other methods to follow?</p>