Skip to content

CLOSE

Close a cursor.

CLOSE { name | ALL }

You can close all open cursors or a specific cursor that you name. After you have closed a cursor, no subsequent operations are allowed on it. Close a cursor when it is no longer needed.

For example, close a named cursor within a script:

begin;
declare match cursor for select * from match order by matchday;
fetch next from match;
...
close match;
end;

Close all cursors:

premdb=# close all;
CLOSE CURSOR ALL

Parent topic:SQL Commands