title: Error when creating stored procedure in postgres
body: <p>I am trying to convert an oracle stored procedure to Postgres function/procedure.</p>
  
  <p>I did some research and read many forums to prepare the syntax for the stored procedure in postgres.</p>
  
  <p>But getting an error for declaring an integer variable.</p>
  
  <p>My code is like below:
  The purpose of my procedure is to load one-month records into another month (EX: load Jan 2020 data into March 2020)</p>
  
  <p>Postgres Procedure:</p>
  
  <pre class="lang-sql prettyprint-override"><code>CREATE OR REPLACE FUNCTION Corporate.copy_forecast(code OUT integer, message OUT VARCHAR) 
          LANGUAGE plpgsql
      AS $$ 
  DECLARE 
    v_current_month integer;
    v_previous_month integer;
  begin 
    select max(cycleid) into v_previous_month,  max(cycleid)+1 into v_current_month from Corporate.forecast;
  
    INSERT INTO Corporate.forecast 
    (SELECT v_current_month,lob,delivery,forecast_val
     FROM Corporate.forecast 
     WHERE month= v_previous_month);
  
    code:=1;
    message:='Sucussfully loaded previous month forecast to current month';                                       
  exception
    when others then 
    code:=0;
    message:='Failed';
  END;
  $$
  </code></pre>
  
  <p>Please help me to fix the above procedure.</p>