Problem: To get results from my SP I need to recompile every time.
Purpose of the SP: to construct XML out of each row in a table.
Description: After running the SP for the first time post compilation the SP does not return any data unless recompiled even though there are valid rows in the table.
The outline of my code is..
qry := 'select * from mytable where flag2 = 0 and flag1 = 1';
qContext := DBMS_XMLGEN.newContext(qry);
DBMS_XMLGEN.setrowtag(qContext, 'RowFromDB');
DBMS_XMLGEN.setrowsettag(qContext, 'RowTag');
dbms_xmlgen.setmaxrows(qContext, 1);
retXML := '';
loop
tmprowxml := DBMS_XMLGEN.getxml(qContext);
exit when dbms_xmlgen.getnumrowsprocessed(qContext) = 0;
tmprowxml := replace(tmprowxml, '<?xml version="1.0"?>');
retXML := retXML || tmprowxml;
// code to update flag2 to 1
end loop;
DBMS_XMLGEN.closecontext(qcontext);
COMMIT;
return retXML;
Appreciate any pointers.