<bdo id='Yc1XY'></bdo><ul id='Yc1XY'></ul>

    1. <tfoot id='Yc1XY'></tfoot>
      1. <i id='Yc1XY'><tr id='Yc1XY'><dt id='Yc1XY'><q id='Yc1XY'><span id='Yc1XY'><b id='Yc1XY'><form id='Yc1XY'><ins id='Yc1XY'></ins><ul id='Yc1XY'></ul><sub id='Yc1XY'></sub></form><legend id='Yc1XY'></legend><bdo id='Yc1XY'><pre id='Yc1XY'><center id='Yc1XY'></center></pre></bdo></b><th id='Yc1XY'></th></span></q></dt></tr></i><div id='Yc1XY'><tfoot id='Yc1XY'></tfoot><dl id='Yc1XY'><fieldset id='Yc1XY'></fieldset></dl></div>
        <legend id='Yc1XY'><style id='Yc1XY'><dir id='Yc1XY'><q id='Yc1XY'></q></dir></style></legend>

      2. <small id='Yc1XY'></small><noframes id='Yc1XY'>

      3. 使用 Oracle 中的 UTL_FILE 包在 ExcelSheet 中写入

        时间:2023-11-02

                  <bdo id='k46tP'></bdo><ul id='k46tP'></ul>
                    <tbody id='k46tP'></tbody>
                  <legend id='k46tP'><style id='k46tP'><dir id='k46tP'><q id='k46tP'></q></dir></style></legend>

                  <small id='k46tP'></small><noframes id='k46tP'>

                • <i id='k46tP'><tr id='k46tP'><dt id='k46tP'><q id='k46tP'><span id='k46tP'><b id='k46tP'><form id='k46tP'><ins id='k46tP'></ins><ul id='k46tP'></ul><sub id='k46tP'></sub></form><legend id='k46tP'></legend><bdo id='k46tP'><pre id='k46tP'><center id='k46tP'></center></pre></bdo></b><th id='k46tP'></th></span></q></dt></tr></i><div id='k46tP'><tfoot id='k46tP'></tfoot><dl id='k46tP'><fieldset id='k46tP'></fieldset></dl></div>

                  <tfoot id='k46tP'></tfoot>

                  本文介绍了使用 Oracle 中的 UTL_FILE 包在 ExcelSheet 中写入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在存储在某个预定义目录中的 Excel 表中写入数据没有问题.

                  I have no problem in writing data in excel sheet which is stored in some predefined directory.

                  现在我有 10 组数据,对于每组数据,我必须创建 10 个单独的 excel 表.但我想要的是创建工作簿 conating sheet1,sheet2,.表 10.其中将有所有10组记录.如果我的问题不清楚,请告诉我.

                  Now I have 10 sets of data and for each set I have to create 10 seperate excel sheet. But what I want is to create Workbook conating sheet1,sheet2,. Sheet10. Which will have all 10 sets of record. If my question is not clear let me know.

                  我使用的是 PL/SQL Oracle 9i

                  I'm using PL/SQL Oracle 9i

                  我的代码将为一组数据写入excel.如果我有更多数据集并且不想拥有多个 Excel 工作表,而是想要一个带有差异工作表的工作簿,该怎么办.

                  My Code which will write to excel for one set of data. What if I have more set of data and I don't want to have multiple excel sheet instead I want one workbook with diff sheet.

                  CREATE OR REPLACE PROCEDURE SP_ORACLE_EXCEL(I_FILE_NAME    IN VARCHAR2) AS
                  
                    FILENAME  UTL_FILE.FILE_TYPE;
                    FILENAME1 VARCHAR2(1000);
                    CURSOR C1 IS
                      SELECT * FROM MY_TABLE;
                    VARC1 C1%ROWTYPE;
                  BEGIN
                  
                    FILENAME1   := 'TEST_' || I_FILE_NAME || '_' || SYSDATE || '.CSV';
                  
                    FILENAME    := UTL_FILE.FOPEN('TEMP_DIR', FILENAME1, 'W');
                  
                    /* THIS WILL CREATE THE HEADING IN EXCEL SHEET */
                      UTL_FILE.PUT_LINE(FILENAME,
                                     'HEADER1' || ',' || 'HEADER2' || ',' || 'HEADER3' || ',' ||
                                      'HEADER4' || ',' || 'HEADER5');
                    OPEN C1;
                    LOOP
                      FETCH C1
                         INTO VARC1;
                      EXIT WHEN C1%NOTFOUND;
                       /*  THIS WILL PRINT THE RECORDS IN EXCEL SHEET AS PER THE QUERY IN CURSOR */
                      UTL_FILE.PUT_LINE(FILENAME,
                                        '"' || VARC1.COL1 || '"' || ' ,' || '"' ||
                                        VARC1.COL2 || '"' || ' ,' || '"' ||
                                        VARC1.COL3 || '"' || ' ,' || '"' ||
                                        VARC1.COL4 || '"' || ' ,' || '"' ||
                                        VARC1.COL5|| '"');
                  
                  
                    END LOOP;
                  
                    UTL_FILE.FCLOSE(FILENAME);
                  
                  END SP_ORACLE_EXCEL;
                  

                  推荐答案

                  我知道没有现成的实现.

                  There's no ready-to-use implementation that I'm aware of.

                  Excel 文件 (.xslx) 自 07 年以来实际上是包含每个工作表的单独 xml 文件的 zip 存档.

                  Excel files (.xslx) since '07 are actually zip archives containing separate xml files for each worksheet.

                  他们使用的 XML 架构是非常简单.您必须使用 Java 来创建文件夹并进行 zip 压缩才能写入此类文件.

                  The XML schema they're using is pretty straight forward. You'd have to use Java to create the folders and do the zip compression in order to write such files.

                  这篇关于使用 Oracle 中的 UTL_FILE 包在 ExcelSheet 中写入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:SUBSTR 在 CLOB 上的表现 下一篇:可以在 PL/SQL 内部创建 Oracle 数据库对象类型吗?

                  相关文章

                • <small id='i8C0r'></small><noframes id='i8C0r'>

                    <legend id='i8C0r'><style id='i8C0r'><dir id='i8C0r'><q id='i8C0r'></q></dir></style></legend>

                    1. <i id='i8C0r'><tr id='i8C0r'><dt id='i8C0r'><q id='i8C0r'><span id='i8C0r'><b id='i8C0r'><form id='i8C0r'><ins id='i8C0r'></ins><ul id='i8C0r'></ul><sub id='i8C0r'></sub></form><legend id='i8C0r'></legend><bdo id='i8C0r'><pre id='i8C0r'><center id='i8C0r'></center></pre></bdo></b><th id='i8C0r'></th></span></q></dt></tr></i><div id='i8C0r'><tfoot id='i8C0r'></tfoot><dl id='i8C0r'><fieldset id='i8C0r'></fieldset></dl></div>
                    2. <tfoot id='i8C0r'></tfoot>
                      • <bdo id='i8C0r'></bdo><ul id='i8C0r'></ul>