title: How to return two table in PostgreSQL
body: <p>I'm new in POSTGRESQL and I am creating PostgreSQL functions, and now I want to create a function which returns two table output, I created and it does not work </p>
  
  <p>my function </p>
  
  <pre><code>CREATE FUNCTION getData() RETURNS setof refcursor AS
  $$
  DECLARE c_top_items refcursor;
  DECLARE c_shopping_cart refcursor;
  BEGIN
      OPEN c_top_items FOR
          SELECT t.name
          FROM employee t
          LIMIT 10;
      RETURN NEXT c_top_items;
      OPEN c_shopping_cart FOR
          SELECT c.name
          FROM employee c
          LIMIT 5;
      RETURN NEXT c_shopping_cart;
  END;
  $$ LANGUAGE plpgsql;
  </code></pre>
  
  <p>Please help!!</p>