postgresql_16:7.1.97.1 Description
PostgreSQL 16 > Reference > SQL Commands > DECLARE > Description
DECLARE allows a user to create cursors, which can be used to retrieve a small number of rows at a time out of a larger query. After the cursor is created, rows are fetched from it using FETCH (see postgresql_16:7.1.147).
Note
This page describes usage of cursors at the SQL command level. If you are trying to use cursors inside a PL/pgSQL function, the rules are different — see (see postgresql_16:6.6.7).