statement
FETCH
Retrieves a row from an open cursor and advances its position. Exhaustion can return no rows. Example target: PostgreSQL 17. Use only the isolated starter dataset; setup and expected results are in the batch evidence.
Formal Syntax & Structure
sql syntaxsql
FETCH NEXT FROM cursor_nameWorking Example
Example Snippetsql
BEGIN; DECLARE lab_cursor CURSOR FOR SELECT id FROM customers ORDER BY id;FETCH NEXT FROM lab_cursor;