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

        -- save the XML into the CLOB result.
        result :=  DBMS_XMLGEN.getXML(qryCtx);
        EXIT WHEN DBMS_XMLGEN.getNumRowsProcessed((qryCtx)=0);
 
        -- store the data to a temporary table
        INSERT INTO temp_clob_tab VALUES(result);

    END LOOP;
END dump_pcd;