title: How to get result set from PostgreSQL stored procedure?
body: <p>I created a stored procedure in PostgreSQL 11 to perform CRUD operation, and it works fine for 1. Create 2. Update 3. Delete, but while I run read command by passing <code>Condition = 4</code> to select a result set, I get below error.</p>
  
  <p>I have used PostgreSQL function to get result set it works for me, but I need to get result using the PostgreSQL stored procedure.</p>
  
  <p>Here is my code for stored procedure:</p>
  
  <pre><code>CREATE OR REPLACE PROCEDURE public.testSpCrud(
      fnam text,
      lnam text,
      id integer,
      condition integer)
  LANGUAGE 'plpgsql'
  
  AS $BODY$
  declare
      countOfDisc int; 
  BEGIN
  if condition=1 then
  
  INSERT INTO public.employee(
      employeeid, lname, fname, securitylevel, employeepassword, hphonearea, hphone, cphonearea, cphone, street, city, state, zipcode, extzip, name, email, groomerid, type, commission, inactive, carrierid, notoallemployees, languageid, isdogwalker, ispetsitter, ismobilegroomer, ssma_timestamp)
      VALUES (4,  'Test', 'Test', 2, 2, 32, 32, 32, 32, 32, 32,32, 32, 32, 22, 22, 2, 2, 2, false, 223,true, 223, true, true, true, '2019-08-27');
  end if;
   if condition =2 then
      delete from Employee where employeeid=id;
      end if;
       if condition =3 then
      update Employee set fname='Test' where employeeid=id;
      end if;
       if condition =4 then
           Select * from Employee;
      end if;
      END;
  $BODY$;
  </code></pre>
  
  <blockquote>
  <pre><code>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 testspcrud(text,text,integer,integer) line 22 at SQL statement
  SQL state: 42601
  </code></pre>
  </blockquote>