Has anybody faced a problem with reusing a ref cursor?

C1 refcursor;
....
   stmt := 'select1 ' ;
   open C1 for execute  stmt;
   fetch C1 into rc1;
   close C1;

   stmt := 'select2 ...' ;
   open C1 for execute  stmt;
   fetch C1 into rc2;
   close C1; 

???

I am getting inconsistent errors:   IDTCONTEXT:  PL/pgSQL function ...... ) 
line 42 at FETCH

PG Version 9.5.5 on Linux.

Thanks

Danny


Reply via email to