Queries produce sets of tuples as a result,while none of the major host languages supports a set data type directly.So,cursors are used. A cursor declaration:EXEC SOL DECLARE <cursor>CURSOR FOR <query> A statement EXEC SOL OPEN<cursor>:the cursor is ready to retrieve the first tuple of the relation over which the cursor ranges. EXEC SOL FETCH FROM<cursor INTO <list of variables> EXEC SOL CLOSE <cursor>:the cursor is no longer ranges over tuples of the relation.Queries produce sets of tuples as a result, while none of the major host languages supports a set data type directly. So, cursors are used. A cursor declaration: EXEC SQL DECLARE <cursor> CURSOR FOR <query> A statement EXEC SQL OPEN<cursor> : the cursor is ready to retrieve the first tuple of the relation over which the cursor ranges. EXEC SQL FETCH FROM < cursor > INTO <list of variables> EXEC SQL CLOSE <cursor>: the cursor is no longer ranges over tuples of the relation