开发者

oracle sql developer is truncating my results

开发者 https://www.devze.com 2022-12-26 08:43 出处:网络
I\'m calling a stored function like this: select XML_INVOICE.GENERATE_XML_DOC(\'84200006823\') from dual;

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[&开发者_如何学运维lt;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?


I was having the same issue in SQL Developer 4. Here is what worked for me:

set long 100000;
set longchunksize 100000;

And then re-run the query. You should now be able to see the full cell in the grid view and export it to csv as well.

(The OP is no longer with the same job or using Oracle, but this question is one of the first results in google, so hopefully this will help people having the same problem.)


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)


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;


Run as a Script (F5) rather than as a Statement (Ctrl+Enter)

The output will then go to the Script Output window rather than the Query Output, and you will be able to Copy and Paste it

0

精彩评论

暂无评论...
验证码 换一张
取 消