73
Cursors
–printf(“<allProducts>\n”);
–while (1) {
–     EXEC SQL FETCH FROM crs INTO :n, :p, :q, :c;
–     if (NO_MORE_TUPLES) break;
–     printf(“    <product>\n”);
–     printf(“           <name>      %s    </name>\n”,     n);
–     printf(“           <price>       %d   </price>\n”,      p);
–     printf(“           <quantity>  %d   </quantity>\n”, q);
–     printf(“           <maker>     %s   </maker>\n”,     c);
–     printf(“    </product>\n”);
–}
–EXECT SQL CLOSE crs;
–printf(“</allProducts>\n”);
•}