tags:

views:

234

answers:

2

I'm calling a stored function like this:

select XML_INVOICE.GENERATE_XML_DOC('84200006823') from dual;

The query results then show up in a table underneath, which I can right click and select "Export Data" -> XML

<?xml version='1.0'  encoding='UTF8' ?>
<RESULTS>
  <ROW>
    <COLUMN NAME="XML_INVOICE.GENERATE_XML_DOC('84200006823')" <![CDATA[<xml>yada yada</xml><morexml>...]]></COLUMN>
  </ROW>
</RESULTS>

The problem is the "..." - SQL Developer (2.1.0.63 on Linux) is not showing all the data - its truncating the result and appending the ellipsis. This is of no use to me. How do I get it to export ALL of my data?

A: 

1) Insert the result of the SP into a table

select XML_INVOICE.GENERATE_XML_DOC('84200006823') into schema.table from dual;

(will be only one row)

Use exp to export table

EXP username/password@instance TABLES=(tablename)

sensware
I'd like to try this, but I'm not sure how. Don't I need to create the table first? what should the table schema be? and what is instance? It looks to me like this is on the server end, which I don't have access to. Isn't there some straightforward way to get the results of this query? I suppose I could write a whole program to do get the results of a query and write it out. *sigh* But isn't that what SQL developer is for?
nont
A: 

Another solution would be to write directly a XML file see example below, and adjust to fit:

CREATE OR REPLACE PROCEDURE output_xml_file 
(inFileName         Varchar2 )   --user defined prefix for file name        
 AS

            fp UTL_FILE.FILE_TYPE;   
                v_filename  VARCHAR2(150);
            v_XML_Result VARCHAR2(4000);    

BEGIN

          v_filename:=infilename||'.xml';

          fp := UTL_FILE.FOPEN('c:\pathtofolder', v_filename, 'W', 4000);

          select XML_INVOICE.GENERATE_XML_DOC(inFileName) into v_XML_Result from dual; 

          UTL_FILE.PUT_LINE(fp, v_XML_Result);
          UTL_FILE.FCLOSE(fp);

          EXCEPTION

            WHEN OTHERS THEN

              UTL_FILE.FCLOSE(fp);
              raise;
    END output_xml_file;
    /
    SHOW ERRORS;
    GRANT EXECUTE ON output_xml_file TO PUBLIC;
sensware
I appreciate your response. However, this code creates a file on the server! The DBAs don't take kindly to that, and besides, they don't grant "mere" developers access to read files on the oracle server. So, this doesn't help me much.
nont