title: oracle stored procedure OUT parameter vs. postgresql pl/pgsql function OUT parameter
body: <p>I'm trying to port oracle stored procedures (plsql) to a postgresql function (pl/pgsql).</p>
  
  <p>In oracle I can define a stored procedure with IN and OUT parameters.</p>
  
  <pre><code>CREATE OR REPLACE PROCEDURE MY_TEST(foo IN NUMBER,
                                      bar OUT NUMBER)
  IS 
  BEGIN
  bar := 1
  END
  </code></pre>
  
  <p>This will store a value of 1 in the variable that is passed to the stored procedure.
  I can call it as follows:</p>
  
  <pre><code>DECLARE
  outValue NUMBER ;
  BEGIN
  Exec MY_TEST(10, outValue); 
  DBMS_OUTPUT.PUT_LINE('Value Returned Is : '||outValue) ;
  END ;
  </code></pre>
  
  <p>In Postgresql (pl/pgsql) I can define a function like this one:</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION MY_TEST(foo IN NUMBER,
                                     bar OUT NUMBER)
  BEGIN
  bar := 1
  END;
  $body$
  LANGUAGE PLPGSQL;
  </code></pre>
  
  <p>However I can not use the out parameter the same way as I could in oracle.
  In postgresql the OUT parameter defines the return value.
  In oracle stored procedures don't have return values, but instead write the output into the variable that is passed in the call</p>
  
  <p>Is there something I overlooked, that would permit me to use pl/pgsql functions in a similar way as the stored procedure is used in the example above?</p>
  
  <p>Any hints are greatly appreciated.</p>