Saving UTL_FILE of Oracle 9i DataBase

Hi all!

I have a problen save an XML file that is generated in the SQL sentence in my Oracle 9i Database when the file is greater than 32 KB.

To save the file that I use UTL_FILE library and I found that there is the problem.

The code I use is as follows:

CREATE OR REPLACE PROCEDURE SIGADMIN. PRUEBA_CAUC0004_EXT AUTHID CURRENT_USER IS
CLOB XML;
VXML varchar2 (100);
..
..
xfile utl_file.file_type;
doc xmldom. DOMDocument;
..
..
BEGIN
..
..

-Inicializamos el CLOB
DBMS_LOB. CreateTemporary (xml, TRUE);
..
..

-Pasar el DOM document a CLOB
xmldom.writeToClob (doc, xml);

xfile: = utl_file.fopen('TEMP_DIR','PRUEBA_CAUC0004.xml','w');
..
..
WHILE (pos, len) LOOP
VXML: = dbms_lob.substr(xml,100,pos);
UTL_FILE.put (xfile, VXML);

POS: = pos + 100;
END OF LOOP
-Liberamos los recursos
xmldom.freeDocument (doc);
UTL_FILE.fclose (x);
..
..
..

In general, it is much easier to use"dbms_xslprocessor.clob2file" as shown in the following pseudocode:

declare
   xml xmltype;
   cl   clob;
begin
   xml := build_your_xml();
   cl := convert_xml_to_clob(xml);
   dbms_xslprocessor.clob2file (cl, 'YOUR_DIRECTORY', 'YOUR_FILENAME');
end;
/

Tags: Database

Similar Questions

  • Import of XML in the oracle 11g database

    I have some difficulty parsing of an XML file in the oracle 11g database.

    Currently using Oracle 11 g Express Edition (XE)

    Here's how my XML file looks like this:


    <? XML version = "1.0" encoding = "UTF-8" standalone = "yes"? >
    -< AccountMap xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" >
    -< account >
    -< AccountMapping >
    < AccountID > 0000000000000 - 000 < / AccountID >
    < AccountName > XLS < / AccountName >
    Excel < AccountType > < / AccountType >
    < AccountOwner > system < / AccountOwner >
    < / AccountMapping >
    -< AccountMapping >
    < AccountID > 0000000000000 - 001 < / AccountID >
    < AccountName > XLSS < / AccountName >
    Excel2 < AccountType > < / AccountType >
    System2 < AccountOwner > < / AccountOwner >
    < / AccountMapping >
    -< AccountMapping >

    and so now the file continues... I have the xml file that is saved on my hard drive

    I created a package in SQL Developer

    create or replace
    PACKAGE XML_FILEHANDLER AS

    type TRecord is (record
    Account_ID varchar2 (100)
    , Varchar2 (100) AccountName
    , Varchar2 (30) AccountType
    , AccountOwner varchar2 (100)
    );

    type TRecordTable is table of the TRecord;

    getRows function (p_directory in varchar2, p_filename in varchar2) return TRecordTable pipeline;

    END XML_FILEHANDLER;

    -BODY

    create or replace
    PACKAGE BODY XML_FILEHANDLER AS

    getRows function (p_directory in varchar2, p_filename in varchar2) return TRecordTable AS pipeline

    nb_rec NUMBER: = 1;
    tmp_xml CLOB.
    tmp_file CLOB.
    REC TRecord;

    BEGIN

    DBMS_LOB.CREATETEMPORARY (tmp_file, true);
    tmp_file: = dbms_xslprocessor.read2clob (p_directory, p_filename);

    recomm. Account_ID: = regexp_replace (tmp_file, '. * <>(. *) Account_ID < / Account_ID >. *', '\1', 1, 1, 'n');
    recomm. AccountName: = regexp_replace (tmp_file, '. * < AccountName >(.*) < / AccountName >. *', '\1', 1, 1, 'n');
    recomm. AccountType: = regexp_replace (tmp_file, '. * < AccountType >(.*) < / AccountType >. *', '\1', 1, 1, 'n');
    recomm. AccountOwner: = regexp_replace (tmp_file, '. * < AccountOwner >(.*) < / AccountOwner >. *', '\1', 1, 1, 'n');

    loop

    -This regexp is instance (s) of this model: "<? XML...? ' > < root_tag >... < / root_tag >.
    tmp_xml: = regexp_substr ([tmp_file, ' < \?xml[^?] +------? > \s+ < ([^ >] +) >. *? < / \1 > ', 1, nb_rec, 'n');
    When the output length (tmp_xml) = 0;
    -dbms_output.put_line (tmp_rec);
    nb_rec: = nb_rec + 1;

    SELECT Account_ID AccountName, AccountType, AccountOwner
    in rec. Account_ID, rec. AccountName, AccountType rec. rec. AccountOwner
    from xmltable)
    "Accounts/AccountMapping" in the way of xmltype (tmp_xml) columns
    Path of varchar2 (100) Account_ID 'Account_ID '.
    , Path of varchar2 (100) AccountName "AccountName".
    , AccountType varchar2 (30) path 'AccountType '.
    , Path of varchar2 (100) AccountOwner "AccountOwner.
    );

    line (CRE);

    end loop;

    DBMS_LOB.freeTemporary (tmp_file);

    GetRows END;

    END XML_FILEHANDLER;

    -I call my function using the following sql query

    Select * from table (XML_FileHandler.getRows ("XML", "test.xml"));

    Here is the error I get

    ORA-29283: invalid file operation
    ORA-06512: at "SYS." UTL_FILE", line 536
    ORA-29283: invalid file operation
    ORA-06512: at "XDB". DBMS_XSLPROCESSOR', line 265
    ORA-06512: at "user. XML_FILEHANDLER', line 13
    29283 00000 - "invalid file operation.
    * Cause: An attempt was made to read from a file or a directory which is
    not exist, or the file or directory access was denied by the
    Operating system.
    * Action: Check access privileges to the file and directory on the file system
    and if reading, check that the file exists.

    I did the following

    -Provided appropriate access to the user (read, write), including directory access rights
    -ensure that the directory exists
    -to ensure the existence of the file

    I have searched all over google and metalink but am unable to get this to run... Help, please!

    >
    SELECT Account_ID AccountName, AccountType, AccountOwner
    in rec. Account_ID, rec. AccountName, AccountType rec. rec. AccountOwner
    from xmltable)
    "Accounts/AccountMapping" in the way of xmltype (tmp_xml) columns
    Path of varchar2 (100) Account_ID 'Account_ID '.
    , Path of varchar2 (100) AccountName "AccountName".
    , AccountType varchar2 (30) path 'AccountType '.
    , Path of varchar2 (100) AccountOwner "AccountOwner.
    );
    >
    implement

    SELECT Account_ID, AccountName, AccountType, AccountOwner
    into rec.Account_ID, rec.AccountName, rec.AccountType, rec.AccountOwner
    from xmltable(
    'AccountMap/Accounts/AccountMapping' passing xmltype(tmp_xml) columns
    Account_ID varchar2(100) path 'Account_ID'
    , AccountName varchar2(100) path 'AccountName'
    , AccountType varchar2(30) path 'AccountType'
    , AccountOwner varchar2(100) path 'AccountOwner'
    );
    
    SQL> SELECT Account_ID, AccountName, AccountType, AccountOwner
      2  --into rec.Account_ID, rec.AccountName, rec.AccountType, rec.AccountOwner
      3  from xmltable(
      4  'AccountMap/Accounts/AccountMapping' passing
      5  xmltype('
      6  
      7  
      8  
      9  0000000000000-000
     10  XLS
     11  Excel
     12  System
     13  
     14  
     15  0000000000000-001
     16  XLSS
     17  Excel2
     18  System2
     19  
     20  
     21  ')
     22  columns
     23  Account_ID varchar2(100) path 'Account_ID'
     24  , AccountName varchar2(100) path 'AccountName'
     25  , AccountType varchar2(30) path 'AccountType'
     26  , AccountOwner varchar2(100) path 'AccountOwner'
     27  );
    
    ACCOUNT_ID                                                                       ACCOUNTNAME                                                                      ACCOUNTTYPE                    ACCOUNTOWNER
    -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ------------------------------ --------------------------------------------------------------------------------
                                                                                     XLS                                                                              Excel                          System
                                                                                     XLSS                                                                             Excel2                         System2
    
    SQL> 
    

    AccountID use AccountID not Account_ID

    Account_ID varchar2(100) path 'AccountID'
    

    Published by: Alexandr on August 9, 2012 12:35 AM

  • Character set US7ASCII AL32UTF8 migration to Oracle Applications database

    What is the best method to get the character set migration of Oracle Applications database?

    The options available are

    (1) export and import

    (2) CSALTER

    (3) DMU

    Database - 11g

    Applications - R12

    Please suggest some tips and recommendations.

    Kind regards

    Nordine

    Post edited by: e0d0dacd-a343-414e-bfc0-aff53eaab398

    Nordine salvation,

    I suggest you to refer the link: "How do I convert the character set for Oracle R12.1.1 running on 11.0.6 database Oracle US7ASCII' as it is very relevant to you."

    Response to your previous post would be:

    S ' stick to a plan

    -Try all of the activity on the TEST server for yourself

    -Troubleshoot and debug all the question from A - Z

    -On the successful implementation, make a backup of the Production and move the solution to PROD.

    If possible, run a lot of questions while doing the character set migration oracle applications, database because it contains the application tables.

    I accept the fact that EBS database is complicated to a database independent, but still all the features and debugging tools and troubleshooting is the same, although it is autonomous or EBS database.

    We should do if we stuck to the top in with and truncate in the application according to the CSSCAN results tables,.

    little tables when we checked in Metalink he says to avoid these tables which do not affect the database or application.

    Try in a Test Server, the above link helps you on the issue. You can find answer to some tables with loss in metalink if it's a bug, just lift a SRt solve your problem.

    What we must do if we are in important application tables, export and import will help in this issue.

    No, if we have available data with loss, then we cannot use the Import/Export and we will have to use CSALTER instead.

    is this the right method or must contact oracle support for assistance on important application tables.

    YES, I personally recommend you try and paralleling have ongoing Oracle support. So that you will have a guide from A to Z, in the case you're wrong

    Hope this helps

    Best regards

  • B2B - BAM integration does not work with the Oracle XE database

    Hello

    Can someone explain the reasons in detail, 'the B2B - BAM integration does not work with the database Oracle XE'?

    Can't we use XE POC simple to demonstrate BAM?

    Published by: 975946 on December 27, 2012 04:14

    Hi Nithin,

    The main reason for this Oracle XE database can't handle such a huge process. Same Oracle XE is not supported in production.
    Note that SOA requires 300 process and BAM more than 100 processes (400 total), which is in addition to any other requirement its 500 to parameter.but process during the installation of Oracle SOA RCU, I hope you gave 300 single right.so his can't handle as much load if use B2B BAM integration.

    The ultimate goal is to have need to display active data in the right BAM reports? so, if you are using Oracle XE DB its may be not possible to show the active data.that the reason Oracle recommended use / works with Oracle 10 g Oracle 11 g versions EE and EE.

    Best regards
    Siva San.

  • My Oracle 8 database starts?

    Hi experts. Would like to be one.

    We have this old, old Oracle 8i database on a Windows Server. The name of the comic is PROD

    I need to connect to it, but I'm having difficulties.

    I'm looking for services-

    OracleServicePROD IS launched

    OracleStartPROD will not start (maybe because the database is already started?)

    OracleNamesService does not start

    AMT involves IS started


    Can anyone give me any advice for the verification of this database is started, please?
    Thank you, John

    Above described whereas environment and "" SVRMGR30. "» EXE", it is clearly not"8i"8.0.x,, right.

    I guess that I in "Oracle 8i database" in the first post is a typo.

  • Oracle Enterprise database control language in English

    Hello world.

    When Access then Oracle Enterprise Database Control in a Windows 7 Professional in Portuguese, I see the Oracle Enterprise Database Control in Portuguese language. How can I then change control Oracle Enterprise database language to English?

    Thank you

    Direct access to Enterprise Manager in another language

    http://download.Oracle.com/docs/CD/B10501_01/EM.920/a96673/APPD.htm#624335

    check this discussion also. Change language in OEM?

  • enumerate the user tables in oracle 9i database

    Hello

    IM new bi to database oracle,...

    Anyone give me the command to enumerate the user tables in the oracle 9i database. ??.

    IM using linux redhat 4.0... and oracle 9i database...

    Thank you
    Vasanth...

    Hello

    Select sesion.sid,
    sesion. Serial #.
    sesion. UserName,
    sesion.sql_id,
    sesion.sql_child_number,
    optimizer_mode,
    hash_value,
    address,
    sql_text
    v $ sqlarea sqlarea, sesion v$ session
    where sesion.sql_hash_value = sqlarea.hash_value
    and sesion.sql_address = sqlarea.address
    and sesion.username is not null;

    -Pavan Kumar N

  • Is is possible to connect Netbean IDE to the Oracle XE database.

    Is possible to connect Netbean IDE to the Oracle XE database uses drivers provided with Netbean network.

    I m giving continuation of input to Netbean parameter.

    Data entry mode: entry field
    Driver name: JAVA DB (Network)
    Host: light-LMO
    Port: 1521
    Database: XE
    Username:lightweight
    Password: xxxxx


    When tried connecting the Oracle XE using netbean I got following error.


    ubable to add a connection. Could not establish a connection to the jdbc:derby://lightweight-ovm:1521 / XE
    using org.apache.derby.jdbc.ClientDriver (insufficient during the reading of the network - wait a minimum)
    6 bland and received only 1 byrtes. the connection has been lost.


    However, I can able to connect in the jsp pages using the following connection string.

    Class.forName ("oracle.jdbc.driver.OracleDriver");
    Conn = DriverManager.getConnection ("jdbc:oracle:thin:@localhost:1521:XE", "light", "oracle");


    What's not here?

    Please post this in

    Database connectivity - Java Database Connectivity (JDBC) Forums...

    http://forums.Sun.com/forum.jspa?forumid=48&start=0

    Concerning
    Rajesh

  • Windows 7 supports Oracle 9i Database?

    Hi all
    I would like to know which Microsoft Windows 7 does support the oracle 9i database?
    Thanx

    The only certified database for Win7 version is 11 GR 2 - no older versions will be certified.

    http://download.Oracle.com/docs/CD/E11882_01/install.112/e10843/reqs.htm#CHDHGGFE

    HTH
    Srini

  • What are the risks involved in the Migration of Oracle 7 database to oracle10G

    Hello
    As a requirement of business me are necessary for the migration of our current production (Oracle 7.3.4) database to Oracle 10 G R2.

    I need to understand the risk involved in the affirmative and corrective action necessary.
    Your small contribution is greatly appreciated.

    Thanks in advance.

    Kind regards
    Vijay

    I did the migration of Oracle 8.1.6 to 10g database. Although I wasn't about many questions, questions I have met have been documented in Metalink. First, you will need to do a test migration, a UAT and then go to know the risk to go into production.
    I think you need to upgrade to 8.1.7 and migrate then import/export 10g directly. I had faced problems with the database with the Oracle Application database queues.

    Kind regards
    Marie.

  • ODI with local Oracle XE database implementation

    Hi all

    I'm putting in place the ODI with a local Oracle XE database.
    Individuals: WinXP Pro
    Oracle XE 10.2.0

    I was able to create a master repository without a problem.
    I'm trying to connect with the designer of the ODI and I created a "working repository connection", but I get the username/password invalid name when you test the connection.
    I use the Oracle user name password that I used for the creation of the master repository.
    What I'm not doing correctly?

    Thank you
    Bob

    Well I think you enter the user name and password for odi
    the user name for ODI's SUPERVISOR
    and the password for ODI SUNOPSIS

  • How to get a detailed list of all workbooks in Oracle Discoverer Database

    Hello

    Is it possible to create a query that would give me a list of all workbooks in my Oracle Discoverer database which includes what tables were selected to create the query, including the conditions?

    Please let me know.

    Thank you.

    Hi Becky,

    Discoverer should be bundled with the V5 EUL business district. I don't know which versions have, so I'm hoping its all of them. It allows you to build reports on file in the database, when they were performed last etc. I don't know if you can report on database tables.

    I found a useful documentation about installation and usage of this here http://download-uk.oracle.com/docs/html/B10270_01/eul_stat.htm#1004700

    I hope this helps you.

    Kind regards
    Lloyd

  • Import the layer of ESRI file in Oracle Spatial database

    For my current project, all geographical data are stored in files in ESRI layer. I want to convert SDO_GEOMETRY type and load into the Oracle Spatial database. I checked the OTN site, they provided a utility to load the shapefiles to ESRI in Oracle Spatial database, which does not work for my files from ESRI layer. Does anyone know how to convert a layer of ESRI file? I Googled it and can't find any useful information. Thanks for the help!

    FME will take care of it. It is a commercial product of SAFE, but you can get a trial version 30 days on their web site. I have used this method on several projects, I saw the.

    Ivan

  • Procedure of APEX 3.1 to 3.1.2 on the Oracle XE database update

    Hello

    How to make an update of APEX full 3.1 to 3.1.2 on an Oracle XE database with the installation package (which you can normally get to OTN)? I mean the patches from Metalink 7313609 group will not work on a XE database because there is no built-in opatch.

    Is it possible the procedure of normal update should I use for this:

    @apexins password TEMP SYSAUX SYSAUX is


    Thanks in advance,


    Tobias

    Tobias,

    The 3.1.2 patch does not use opatch since it is not patch the Oracle binaries, etc, it's just a SQL script that you run that updates the PLSQL packages, code, etc. inside the database (more than news images, javascript, etc.).

    As such, there is no reason that the patch could not be run on XE (assuming that you are allowed to download the patch etc.).

    John.
    --------------------------------------------
    http://Jes.blogs.shellprompt.NET
    http://www.apex-evangelists.com

  • How patch oracle dataguard database under windows

    Hi friends,

    I need to update a database of Oracle 11 g Dataguard on Windows 8 Pro x 64 with the latest Patch critical update available for this configuration. I read that there is a CPU 20833831 (July 2015).

    What documents Oracle I pay to play? or what are the steps I need to follow? Or what is the best way to accomplish this task?

    Details of PRIMARY database:

    SQL > select * from v version $;

    BANNER

    --------------------------------------------------------------------------------

    Oracle Database 11g Release 11.2.0.4.0 - Production personnel

    PL/SQL Release 11.2.0.4.0 - Production

    CORE Production 11.2.0.4.0

    AMT for 32-bit Windows: Version 11.2.0.4.0 - Production

    NLSRTL Version 11.2.0.4.0 - Production

    SQL > SELECT * FROM history of registry of $;

    ACTION_TIME ACTION NAMESPACE VERSION ID COMMENTS BUNDLE_SERIES

    ---------------------------- ------------------------- ------------ ---------- ---------- ----------------------------------- -----

    08/07/14 21:59:26, 422000 APPLY SERVER 11.2.0.4 WinBundle 4 11.2.0.4.4 PSU

    SQL >

    C:\app\product\11.2.0\dbhome_1\OPatch > lsinventory opatch

    Installer of temporal parchment of Oracle versi¾n 11.2.0.3.6

    Copyright (c) 2013, Oracle Corporation. All rights reserved.

    Oracle home: C:\app\product\112~1.0\dbhome_1

    The central inventory: C:\Program Files (x 86) \Oracle\Inventory

    from: n/a

    OPatch version: 11.2.0.3.6

    YES version: 11.2.0.4.0

    Location of the log file: C:\app\product\112~1.0\dbhome_1\cfgtoollogs\opatch\opatch2015-09-06_19-54-29PM_1.log

    Location of the output file Lsinventory: C:\app\product\112~1.0\dbhome_1\cfgtoollogs\opatch\lsinv\lsinventory2015-09-06_19-54-29PM

    --------------------------------------------------------------------------------

    Nivel superior instalados products (1):

    Oracle Database 11g 11.2.0.4.0

    Hay 1 productos instalados in este directory Rayz of Oracle.

    Sears temporal (1):

    Patch 18296644: applied on Thu Aug 07 18:48:26 COT 2014

    Patch ID: 17560341

    Patch description: "WINDOWS DB BUNDLE . 11.2 PATCH " . 0.4.4: (18296644)"

    Created April 22, 2014, 02:01:38 hours

    Bugs fixed:

    16809786, 17716305, 16180763, 17545847, 17597748, 16992075, 17610798

    18235390, 17446237, 16450169, 16731148, 17761775, 14602788, 17726838

    17441661, 17050888, 17622427, 17546761, 13866822, 16315398, 17215306

    17040764, 14010183, 16837842, 16228604, 17346671, 18084625, 16683112

    14133975, 17721717, 17602269, 16777840, 17577218, 17071721, 16929165

    18241194, 17080436, 17265217, 17036973, 16698971, 4189542, 14852021

    16399083, 13609098, 17493764, 16785708, 17987366, 16187992, 17781991

    17313525, 16833527, 16618694, 17741995, 11733603, 14285317, 17341326

    16491477, 17357979, 17344412, 17088068, 17332800, 13498243, 16850630

    17783588, 14580303, 16296213, 18223971, 17393683, 18069285, 16863422

    16069901, 17443671, 17897511, 18296644, 17389192, 17394950, 10136473

    17785632, 14458214, 18069723, 17397545, 17186905, 17325413, 13364795

    16472716, 17468141, 13944971, 17883081, 16721594, 13853126, 18088509

    17205719, 16849620, 17284817, 17239687, 17079301, 18180390, 16976121

    17235750, 17951124, 17564992, 17754782, 17082359, 16314254, 17478145

    18154779, 18160822, 16613964, 17174582, 16043574, 17865671, 16943711

    18232462, 17612828, 17375354, 17393915, 17571306, 16825679, 18230522

    17546973, 17209410, 16633319, 16956380, 13077335, 16470836, 18328509

    12905058, 17921190, 17799716, 17614227, 18094246, 18018515, 18034871

    17672719, 16912439, 17385178, 16394467, 16220077, 17016369, 18115594

    17501491, 17027426, 17591148, 16875449, 17465741, 17752121, 17892268

    17614134, 14829250, 17288409, 17296856, 16285691, 17390431, 14338435, 17323222

    --------------------------------------------------------------------------------

    OPatch succeeded.

    Best regards

    dbape.

    What documents Oracle I pay to play? or what are the steps I need to follow? Or what is the best way to accomplish this task?

    1 doc oracle suggest to talk about the 'Readme file' patch... remember this is a basic step that you do.

    2. go to read me and follow the steps of which has suggested correction doc. Nobody does something special on the benches.

    -KumarN pavan

Maybe you are looking for