title: how can we declare a variable in cursor in postgresql
body: <p>I want to store the result of fetch into a variable how we can do that in postgresql?</p>
  
  <p>I also tried by creating a function it isn't working</p>
  
  <p>code :</p>
  
  <pre><code>begin work;
  
  DECLARE 
  
      cur_films CURSOR
         FOR select CURRENT_DATE + i date_
         FROM  generate_series(date '2019-11-11'- CURRENT_DATE,  date '2019-11-15' - CURRENT_DATE ) i;
         fetch forward 2 from cur_films;
  
  close cur_films;
  
  commit work; 
  </code></pre>