DB2 Cursor builds a results table to hold all the rows retrieved by executing a SELECT statement. DB2 uses a…