Autor Tema: como crear un xml desde oracle  (Leído 3886 veces)

0 Usuarios y 1 Visitante están viendo este tema.

iraheta

  • Visitante
como crear un xml desde oracle
« : enero 21, 2008, 12:18:34 pm »
hola, estoy usando oracle 10g y quiesiera saber como sacar un xml desde una tabla de la base, la tabla tiene 5 columnas, 2 varchar2(50) , 2 number, intente usar esta lnea pero me genera error:

DECLARE
           Ctx    DBMS_XMLGEN.ctxHandle;   -- Var's to convert SQL output to XML
           xml    clob;
           emp_no NUMBER := 7369;

           xmlc   varchar2(4000);          -- Var's required to convert lob to varchar
           off    integer := 1;
           len    integer := 4000;
   BEGIN
           Ctx := DBMS_XMLGEN.newContext('SELECT * FROM datos');
           DBMS_XMLGen.setRowsetTag(Ctx, 'EMP_TABLE');
           DBMS_XMLGen.setRowTag(Ctx, 'EMP_ROW');
           DBMS_XMLGEN.closeContext(Ctx);
           xml := DBMS_XMLGEN.getXML(Ctx);

           DBMS_LOB.READ(xml, len, off, xmlc);   -- Display first part on screen
           DBMS_OUTPUT.PUT_LINE(xmlc);
   END;
/
gracias por la atencion