title: Postgresql stored procedure return table all columns
body: <p>A function is created. The function has a input parameter. I can return a column but I want to return all table columns. Also I want to do if result is zero the function return just 0. How can I do it?
  Here the error result.</p>
  
  <blockquote>
    <p>ERROR:  query has no destination for result data
        HINT:  If you want to discard the results of a SELECT, use PERFORM instead.
        CONTEXT:  PL/pgSQL function dwgcould.returnallcolumns(character varying) line 3 at SQL statement
        ********** Error **********
        ERROR: query has no destination for result data
        SQL state: 42601
        Hint: If you want to discard the results of a SELECT, use PERFORM instead.
        Context: PL/pgSQL function dwgcould.returnallcolumns(character varying) line 3 at SQL statement</p>
  </blockquote>
  
  <pre><code>CREATE OR REPLACE FUNCTION dwgcould.returnallcolumns(IN sessionId character varying)
    RETURNS SETOF public.mytable AS
  $BODY$
  BEGIN
      SELECT * FROM public.mytable WHERE session_id=returnallcolumns.sessionId ORDER BY pro_id DESC LIMIT 1;
  END;
  $BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;
  </code></pre>