14 October 2010

Players tell Steven: "Clean up after yourself!"

The 13 October quiz on cursor variables featured this block:

DECLARE
   l_data   SYS_REFCURSOR;
   l_row    plch_parts%ROWTYPE;
BEGIN
   /*OPEN*/

   LOOP
      FETCH l_data INTO l_row;

      EXIT WHEN l_data%NOTFOUND;
      DBMS_OUTPUT.put_line (l_row.partname);
   END LOOP;
END;
/

and several players noticed that this block was missing a statement to close the cursor.

Very sloppy, Steven! While the lack of a CLOSE statement did not affect the quiz, it certainly reflects poor programming practice.

Thanks for bringing this to my attention. I will change the quiz question and answers to include a CLOSE.

Cheers, SF

No comments:

Post a Comment