Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • See also Laurenz Albe's answer at stackoverflow.com/a/50941121/1179467 for how to iterate over the rows tracked by a cursor, without an anonymous code block. Commented Feb 15, 2020 at 5:51
  • You can use refcursors in function too, no need to use procedures. Moreover, you can return from function setof refcursor - table with names of opened cursors so reader will know them without hardcoding. Commented Oct 1, 2021 at 13:28
  • What about retrieving the cursor from the procedure then iterate through it still within the procedure? More over, what about using a EXECUTE SELECT within the procedure as seen both in geeksforgeeks.org/… ? Am I missing something? Commented Jul 17, 2024 at 14:53