CREATE OR REPLACE PROCEDURE htmlTable AS
 cursor c1 is
      select   *
      from     catalog;
BEGIN
   htp.htmlOpen;

   htp.headOpen;
   htp.title('Simple Example');
   htp.headClose;

   htp.bodyOpen;
   htp.line;

   htp.tableOpen(cattributes => 'border=2 width=60%' );
   htp.tableRowOpen;
   htp.tableHeader('Course Number');
   htp.tableHeader('Course Title');
   htp.tableRowClose;
   for cat_rec in c1 loop
     htp.tableRowOpen;
     htp.tableData(cat_rec.cno);
     htp.tableData(cat_rec.ctitle);
     htp.tableRowClose;
   end loop;
   htp.tableClose;
   htp.bodyClose;
   htp.htmlClose;
   EXCEPTION
     When others Then
        htp.print(SQLERRM);
        htp.bodyClose;
        htp.htmlClose;
END;
/
show errors
