Hallo,

ich habe ein PL/SQL Skript geschrieben, welches mir den Inhalt einer Tabelle in einer XML Datei ausgibt.

Hier der Code:

Code:
DECLARE
  qryCtx DBMS_XMLGEN.ctxHandle;
  result CLOB;
BEGIN
  qryCtx :=  dbms_xmlgen.newContext ('SELECT tran_num from ab_tran where rownum < 3');
  DBMS_XMLGEN.setMaxRows(qryCtx, 5);
  LOOP
    -- save the XML into the CLOB field
    result :=  DBMS_XMLGEN.getXML(qryCtx);
    EXIT WHEN DBMS_XMLGEN.getNumRowsProcessed(qryCtx) = 0;  

    dbms_output.put_line(substr(result,1,255));

   END LOOP;
END;
Ich möchte nun, eine Prozedur hieraus machen, um diese dann aus Java heraus aufzurufen. Leider compiliert die Oracle Prozedur nur mit Compilefehlern. Hier der Code für die Prozedur:

Code:
CREATE OR REPLACE procedure ENDUR11.recon_test(xml OUT CLOB)
IS
BEGIN
  qryCtx DBMS_XMLGEN.ctxHandle;
  qryCtx :=  dbms_xmlgen.newContext ('SELECT tran_num from endur11.ab_tran where rownum < 3');
  DBMS_XMLGEN.setMaxRows(qryCtx, 5);
  LOOP
    -- save the XML into the CLOB field
    result :=  DBMS_XMLGEN.getXML(qryCtx);
    EXIT WHEN DBMS_XMLGEN.getNumRowsProcessed(qryCtx) = 0;  

    dbms_output.put_line(substr(result,1,255));

    -- store the XML to a temporary table
    --INSERT INTO temp_clob_tab VALUES(result);
   END LOOP;
end recon_test;
/
Jemand eine Idee, wie ich die Prozedur richtig anlege?

Gruß
Stefan