How to return multiple select queries from PostgreSQL's functions like we do in MS SQL Procedures
<p>I am currently working on PostgreSQL's functions. Like we return multiple result set in MS SQL procedures by writing multiple select queries, same thing I need to integrate in postgreSQL. I did study and came through following solution :  </p>

<pre><code>CREATE OR REPLACE FUNCTION public.summary_test( IN shoppedfromdate date, IN shoppedtodate date, IN enrollmentfromdate date, IN enrollmenttodate date )

RETURNS 

SETOF refcursor 
AS   
$my_body$

DECLARE Q1 refcursor;
DECLARE Q2 refcursor;

BEGIN
    OPEN Q1 for 
        Select  t_cs_dummy.text_data,t_cs_dummy.bigint_data from public.t_cs_dummy ;
    RETURN NEXT Q1;

    OPEN Q2 FOR 
        Select  date_data,datetime_data from public.t_cs_dummy ;
    RETURN NEXT Q2;



END;
$my_body$
  LANGUAGE plpgsql IMMUTABLE SECURITY DEFINER
  COST 10;
</code></pre>

<p>Please let me know, Is this is proper way ? if 'No' then is there any alternative way to do so??</p>