CREATE OR REPLACE procedure dump_pcd AS qryCtx DBMS_XMLGEN.ctxHandle; result CLOB; BEGIN qryCtx := dbms_xmlgen.newContext ('SELECT * from employees;'); DBMS_XMLGEN.setRowTag(qryCtx, 'EMPLOYEE'); DBMS_XMLGEN.setMaxRows(qryCtx, 5); LOOP result := DBMS_XMLGEN.getXML(qryCtx); EXIT WHEN DBMS_XMLGEN.getNumRowsProcessed((qryCtx)=0); INSERT INTO temp_clob_tab VALUES(result); END LOOP; END dump_pcd; The following XML is generated from the above procedure: 30 SCOTT 20000 31 MARY 25