Reading XML File in Oracle 10g

Can anybody tell me How to Read an XML file into Oracle Table and update the Records.
Please guide me.

http://www.oracle.com/technology/sample_code/tech/java/codesnippet/xmldb/HowToLoadLargeXML.html
or else straighter way, go here:
XML DB
Edited by: Ora on Feb 16, 2011 1:32 AM

Similar Messages

  • Reading XML Files from oracle 9i or in Oracle 10g

    Hi all,
    Can any body suggest how to write a stored procedure to read XML file content and insert into a table.
    Thanking you in Advance

    I know I am blasphemous, but ....
    We had a similar requirement: one file, each line was a "simple" xml doc corresponding to one db table record. The keyword here is "simple". We looked at the xml stuff, but decided that the easiest, best runtime performance, most extensible, easiest to maintain was:
    use (sed|awk|perl) to convert xml to a flat file of fields, and then load the file with SQL*Loader. After all, loading flat files with many records is a job for SQL*Loader.
    caveat: the xml in question was very simple and the same for all records:
    timestamp|<log><id>1</id><ns>ns1</ns><prod/><cmd>order</cmd><result>ok</result><time>1813></time></log>
    "your milage may vary"
    -tom

  • XML SCHEMA registration for XML TYPE (storing XML files in Oracle 10g)

    I have created the XML Schema for the XML file stored in Oracle 10g and also added this Schema into the database. I have related that schema with the column in the table which contains the XML file. When i execute the query to fetch the data from the stored file i am getting a blank resultset. Is registering the XML Schema is necessary, if yes then please let me know the process of doing it. I have tried following steps to register Schema, but it is not working
    Step1:
    DECLARE
    v_return BOOLEAN;
    BEGIN
    v_return := dbms_xdb.createFolder('/home/');
    v_return := dbms_xdb.createFolder('/home/DEV/');
    v_return := dbms_xdb.createFolder('/home/DEV/xsd/');
    v_return := dbms_xdb.createFolder('/home/DEV/messages/');
    v_return := dbms_xdb.createFolder('/home/DEV/employees/');
    COMMIT;
    END;
    STEP 2:
    Connecting To XML DB
    Step3:
    Register XML schema
    I am failing to execute step number 2 and hence not able to register the schema also.

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by sudeepk:
    If a java exception is thrown probably during ur install u might have forgotten
    grant javauserpriv to scott;
    grant javasyspriv to scott;
    Thanks
    [email protected]
    <HR></BLOCKQUOTE>
    Thank you!!!

  • Loading XML File into Oracle 10G XE

    I am trying to load an XML file into 10G XE from the Utilities interface, I have created a Table to load into but when I try to load I get the following cryptic error "XML Load Error". There is no other information, can someone give me some insight where to start to resolve this problem?

    The error messages when importing fails provided by APEX 2.1 are not very useful as they do not provide any clue...
    If possible, you can try to load XML file with SQL*Loader - probably you will get then more useful error messages.

  • Issue with Date Conversion when loading XML File into Oracle 10g Database

    Hello all,
    I have the interface shown in the screenshot below. In it, amongst other actions, I'm mapping an XML file element representing a date to an Oracle table column defined as DATE. The source and target columns are highlighted in the screenshot.
    !http://img223.imageshack.us/img223/1565/odiscr275.jpg!
    When I execute the interface, I get the following error message:
    java.lang.IllegalArgumentException at java.sql.Date.valueOf(Date.java:103)
    I'm assuming this refers to the date conversion!
    I've already tried replacing SRC_TRADES.DEAL_DATE with TO_DATE( SRC_TRADES.DEAL_DATE, 'DD/MM/YYYY' ) in the Implementation tab. This function was not recognised when I executed the interface, so it didn't work! The date value in the XML file is in DD/MM/YYYY format.
    I'm guessing that Oracle SQL Date functions don't work in the Implementation tab. Please could somebody let me know:
    1. Which Date Conversion function I could use instead?
    2. Where I can find a reference for the methods/functions I can use in the Implementation tab (if such a reference exists)?
    Cheers.
    James

    Hi.
    Try to change the execution area to staging area. After You change it, write in the mapping box just SRC_TRADERS.DEAL_DATE. When You use TO_DATE, the source field typu should be varchar2, not date (as it is in your source datastore)

  • Load XML file to Oracle 10G XE

    The load xml wizard in Oracle XE asks for a table in the HR schema to load into.
    Well I create one using the 'Create Table' procedure with a script that runs and creates the table. Now I have a XML file that matches the table I created and try to load the file contents into the table. I get an error. Am I surprised? no, I am not. Nothing works the first time.
    Is there a preferred format for the xml file that supports loading into a table?
    There appears to be no help file, but then I may be mistaken.
    Could someone show me where to find this help file?

    The bug you are referencing occurs when an Enumerated Value also has min and max lengths specified..
    Eg something like
    <xsd:simpleType name="EnumType">
         <xsd:annotation>
             <xsd:documentation>ENUM_TYPE</xsd:documentation>
         </xsd:annotation>
         <xsd:restriction base="xsd:string">
             <xsd:enumeration value="AA"/>
             <xsd:enumeration value="AB"/>
             <xsd:enumeration value="AE"/>
             <xsd:enumeration value="AK"/>
             <xsd:enumeration value="AL"/>
         </xsd:restriction>
       </xsd:simpleType>
       <xsd:complexType name="TYPE1">
         <xsd:sequence>
             <xsd:element name="TYPE11">
               <xsd:simpleType>
                   <xsd:restriction base="EnumType">
                     <xsd:minLength value="1"/>
                     <xsd:maxLength value="10"/>
                   </xsd:restriction>
               </xsd:simpleType>
             </xsd:element>
          </xsd:sequence>
        </xsd:complexType>
    </xsd:schema> Do you have something like this in your XML Schema. If this is the case try removing the minLength, maxLength as they are redundant, which is probably why we didn't catch this one in internal testing, it sort of falls into the "if it hurts please don't do it" category :). Also the fix for this bug appears to have been backported on top of 9.2.0.6.0 so upgrading to 9.2.0.7.0 or 9.2.0.8.0 or the later releases of 10.1 or 10.2 should fix the problem.

  • Cannot read image file in oracle 10g forms, getting error frm-47100

    I'm unable to read the image from the file location. But If I do re-save via MS-Paint the same image then I'm able to load successfully. I want to load image directly instead of re-save.  Error getting like "frm-47100 Cannot read image file".
    Need your co-operation to solve this issue.
    Thanks in advance!
    declare
      tiff_image_dir varchar2(80):=('D:\IMAGE\');
      photo_filename varchar2(80);
    begin
      photo_filename:=tiff_image_dir||:IMAGE_NO||'.JPG';
      if :image_no is null then
      :Image_no :=:UID_NO;
      end if;
      read_image_file(photo_filename,'JPG','image');
      WRITE_IMAGE_FILE('output.tif','TIFF','g_image_info.image',maximize_compression,original_depth)
    end;

    Hi Sindhu,
    By default any operating system file extension starts after the dot. So in this case when it says 2 dots it will think there is something wrong.
    RajeshALex

  • How to insert folloiwng XML file in Oracle -

    Hello
    This is on Database 11g.
    I have a very large XML file with following elements. I am new to PL SQL XML programming. How can I make Oracle read the OS file location where the XML file is located, open the XML file and insert XML data residing in their tag elements and non-tag elements ?
    <BillOfMaterialItem revisionIdentifier="--" billOfMaterialItemIdentifier="645-173-1" billOfMaterialItemUniqueIdentifier="IVI123019387" itemQuantity="6" globalProductQuantityTypeCode="PerAssembly" globalProductQuantityTypeCodeOther="" notes="" description="3/8" WIDE" proprietarySequenceIdentifier="115510509">
    - <AdditionalAttributes groupLabel="BOM Information">
      <AdditionalAttribute name="Line Number" value="20" dataType="Float" />
      </AdditionalAttributes>
      </BillOfMaterialItem>
    {code}
    Thanks,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    forum has many example
    look at Re: Load xml data in Oracle table
    steps:
    - create oracle directory
    - create table(s) for your data, may be with column xmltype
    - parse xml files from oracle directory and insert into table(s)
    for example
    SQL> select * from v$version where rownum=1;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    SQL>
    SQL> select *
      2      from (xmltable('*'
      3                     passing (xmltype(bfilename('GET_XML','sample.xml'),nls_charset_id('AL32UTF8')))
      4                     columns billofmaterialitem_revisionid varchar2(10) path '/BillOfMaterialItem/@revisionIdentifier'
      5                            , billofmaterialitem_itemid varchar2(20) path '/BillOfMaterialItem/@billOfMaterialItemIdentifier'
      6                            , BillOfMaterialItem_ItUId varchar2(20) PATH '/BillOfMaterialItem/@billOfMaterialItemUniqueIdentifier'
      7                            , billofmaterialitem_itemq varchar2(20) path '/BillOfMaterialItem/@itemQuantity'
      8                            , billofmaterialitem_gqtcode varchar2(20) path '/BillOfMaterialItem/@globalProductQuantityTypeCode'
      9                            , BillOfMaterialItem_notes varchar2(20) PATH '/BillOfMaterialItem/@notes'
    10                            , BillOfMaterialItem_desc varchar2(20) PATH '/BillOfMaterialItem/@description'
    11                            , billofmaterialitem_prseqid varchar2(20) path '/BillOfMaterialItem/@proprietarySequenceIdentifier'
    12                            , additionalattributes_grlbl varchar2(20) path '/BillOfMaterialItem/AdditionalAttributes/@groupLabel'
    13                            , additionalattribute_name varchar2(20) path '/BillOfMaterialItem/AdditionalAttributes//AdditionalAttribute/@name'
    14                            , additionalattribute_value varchar2(20) path '/BillOfMaterialItem/AdditionalAttributes//AdditionalAttribute/@value'
    15                            , AdditionalAttribute_dataType varchar2(20) PATH '/BillOfMaterialItem/AdditionalAttributes//AdditionalAttribute/@dataType'
    16                    )
    17           ) x
    18  /
    BILLOFMATERIALITEM_REVISIONID BILLOFMATERIALITEM_ITEMID BILLOFMATERIALITEM_ITUID BILLOFMATERIALITEM_ITEMQ BILLOFMATERIALITEM_GQTCODE BILLOFMATERIALITEM_NOTES BILLOFMATERIALITEM_DESC BILLOFMATERIALITEM_PRSEQID ADDITIONALATTRIBUTES_GRLBL ADDITIONALATTRIBUTE_NAME ADDITIONALATTRIBUTE_VALUE ADDITIONALATTRIBUTE_DATATYPE
    --                            645-173-1                 IVI123019387             6                        PerAssembly                                         3/8                     115510509                  BOM Information            Line Number              20                        Float
    SQL>

  • How to export a data as an XML file from oracle data base?

    could u pls tell me the step by step procedure for following questions...? how to export a data as an XML file from oracle data base? is it possible? plz tell me itz urgent requirement...
    Thankz in advance
    Bala

    SQL> SELECT * FROM v$version;
    BANNER
    Oracle DATABASE 11g Enterprise Edition Release 11.1.0.6.0 - Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE    11.1.0.6.0      Production
    TNS FOR 32-bit Windows: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    5 rows selected.
    SQL> CREATE OR REPLACE directory utldata AS 'C:\temp';
    Directory created.
    SQL> declare                                                                                                               
      2    doc  DBMS_XMLDOM.DOMDocument;                                                                                       
      3    xdata  XMLTYPE;                                                                                                     
      4                                                                                                                        
      5    CURSOR xmlcur IS                                                                                                    
      6    SELECT xmlelement("Employee",XMLAttributes('http://www.w3.org/2001/XMLSchema' AS "xmlns:xsi",                       
      7                                  'http://www.oracle.com/Employee.xsd' AS "xsi:nonamespaceSchemaLocation")              
      8                              ,xmlelement("EmployeeNumber",e.empno)                                                     
      9                              ,xmlelement("EmployeeName",e.ename)                                                       
    10                              ,xmlelement("Department",xmlelement("DepartmentName",d.dname)                             
    11                                                      ,xmlelement("Location",d.loc)                                     
    12                                         )                                                                              
    13                   )                                                                                                    
    14     FROM   emp e                                                                                                       
    15     ,      dept d                                                                                                      
    16     WHERE  e.DEPTNO=d.DEPTNO;                                                                                          
    17                                                                                                                        
    18  begin                                                                                                                 
    19    OPEN xmlcur;                                                                                                        
    20    FETCH xmlcur INTO xdata;                                                                                            
    21    CLOSE xmlcur;                                                                                                       
    22    doc := DBMS_XMLDOM.NewDOMDocument(xdata);                                                                           
    23    DBMS_XMLDOM.WRITETOFILE(doc, 'UTLDATA/marco.xml');                                                                  
    24  end;                                                                                                                  
    25  /                                                                                                                      
    PL/SQL procedure successfully completed.
    .

  • Reading XML file in database

    I have to read the XML file which is on UNIX and populate the data from XML file in Oracle Table. Can somebody tell me how to do this. We are using Oracle8i Enterprise Edition Release 8.1.7.4.0

    You can use 3 packages called:
    XMLPARSER
    XMLDOM
    XMLPROCESSOR
    XML API Reference - XDK and Oracle XML DB Contents / Search / Index / PDF
    XML Database Developer's Guide - Oracle XML DB Contents / Search / Index / PDF
    XML Developer's Kits Guide - XDK Contents / Search / Index / PDF
    http://otn.oracle.com/pls/db92/db92.docindex?remark=homepage
    Joel Pérez

  • Data Load from XML file to Oracle Table

    Hi,
    I am trying to load data from XML file to Oracle table using DBMS_XMLStore utility.I have performed the prerequisites like creating the directory from APPS user, grant read/write to directory, placing the data file on folder on apps tier, created a procedure ‘insertXML’ to load the data based on metalink note (Note ID: 396573.1 How to Insert XML by passing a file Instead of using Embedded XML). I am running the procedure thru below anonymous block  to insert the data in the table.
    Anonymous block
    declare
      begin
      insertXML('XMLDIR', 'results.xml', 'employee_results');
      end;
    I am getting below error after running the anonymous block.
    Error :     ORA-22288: file or LOB operation FILEOPEN failed”
    Cause :   The operation attempted on the file or LOB failed.
    Action:   See the next error message in the error stack for more detailed
               information.  Also, verify that the file or LOB exists and that
               the necessary privileges are set for the specified operation. If
               the error still persists, report the error to the DBA.
    I searched this error on metalink and found DOC ID 1556652.1 . I Ran the script provided in the document. PFA the script.
    Also, attaching a document that list down the steps that I have followed.
    Please check and let me know if I am missing something in the process. Please help to get this resolve.
    Regards,
    Sankalp

    Thanks Bashar for your prompt response.
    I ran the insert statement but encountered error,below are the error details. statement.
    Error report -
    SQL Error: ORA-22288: file or LOB operation FILEOPEN failed
    No such file or directory
    ORA-06512: at "SYS.XMLTYPE", line 296
    ORA-06512: at line 1
    22288. 00000 -  "file or LOB operation %s failed\n%s"
    *Cause:    The operation attempted on the file or LOB failed.
    *Action:   See the next error message in the error stack for more detailed
               information.  Also, verify that the file or LOB exists and that
               the necessary privileges are set for the specified operation. If
               the error still persists, report the error to the DBA.
    INSERT statement I ran
    INSERT INTO employee_results (USERNAME,FIRSTNAME,LASTNAME,STATUS)
        SELECT *
        FROM XMLTABLE('/Results/Users/User'
               PASSING XMLTYPE(BFILENAME('XMLDIR', 'results.xml'),
               NLS_CHARSET_ID('CHAR_CS'))
               COLUMNS USERNAME  NUMBER(4)    PATH 'USERNAME',
                       FIRSTNAME  VARCHAR2(10) PATH 'FIRSTNAME',
                       LASTNAME    NUMBER(7,2)  PATH 'LASTNAME',
                       STATUS  VARCHAR2(14) PATH 'STATUS'
    Regards,
    Sankalp

  • How to create xml file from Oracle and sending the same xml file to an url

    How to create xml file from Oracle and sending the same xml file to an url

    SQL/XML (XMLElement, XMLForest, XMLAgg, etc) and UTL_HTTP.
    Whether that works for you with the version of Oracle you have, your requirements, and needs is another story. A little detail goes a long way.

  • Create XML file from Oracle DB

    Hi,
    I'm working in a task to create electronic billing for Mexico Rules, to do this; I need to create a XML source that will contain all the information requested from Oracle DB.
    For this reason, I'm looking how to create this XML file from Oracle DB.
    All this is for the new legislations rules in Mexico to use electronic billing.
    Please, if you have any reference about this, let me know.
    Thanks and regards.

    you may want to check out commands like xmlforest and xmlelement
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions221.htm
    copied from documentation
    Purpose
    XMLForest converts each of its argument parameters to XML, and then returns an XML fragment that is the concatenation of these converted arguments.
    •If value_expr is a scalar expression, then you can omit the AS clause, and Oracle Database uses the column name as the element name.
    •If value_expr is an object type or collection, then the AS clause is mandatory, and Oracle uses the specified c_alias as the enclosing tag. The c_alias can be up to 4000 characters.
    •If value_expr is null, then no element is created for that value_expr.
    Examples
    The following example creates an Emp element for a subset of employees, with nested employee_id, last_name, and salary elements as the contents of Emp:
    SELECT XMLELEMENT("Emp",
    XMLFOREST(e.employee_id, e.last_name, e.salary))
    "Emp Element"
    FROM employees e WHERE employee_id = 204;
    Emp Element
    <Emp>
    <EMPLOYEE_ID>204</EMPLOYEE_ID>
    <LAST_NAME>Baer</LAST_NAME>
    <SALARY>10000</SALARY>
    </Emp>

  • Export an XML file from oracle database

    plz help me its urgent requirement....could u pls tell me the step by step procedure for following questions...?how to export a data as an XML file from oracle database? is it possible..?
    thanks in advance,
    Bala. is it possible?
    Edited by: user3523292 on Nov 14, 2008 5:45 AM

    Here's the quick and dirty method using SQL*Plus...
    SQL> select * from emp where deptno = 10;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
          7839 KING       PRESIDENT            17-NOV-81       5000                    10
          7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
    SQL> set markup html on
    SQL&gt; select * from emp where deptno = 10;
    <br>
    <p>
    <table border='1' width='90%' align='center' summary='Script output'>
    <tr>
    <th scope="col">
    EMPNO
    </th>
    <th scope="col">
    ENAME
    </th>
    <th scope="col">
    JOB
    </th>
    <th scope="col">
    MGR
    </th>
    <th scope="col">
    HIREDATE
    </th>
    <th scope="col">
    SAL
    </th>
    <th scope="col">
    COMM
    </th>
    <th scope="col">
    DEPTNO
    </th>
    </tr>
    <tr>
    <td align="right">
          7782
    </td>
    <td>
    CLARK
    </td>
    <td>
    MANAGER
    </td>
    <td align="right">
          7839
    </td>
    <td>
    09-JUN-81
    </td>
    <td align="right">
          2450
    </td>
    <td align="right">
    </td>
    <td align="right">
            10
    </td>
    </tr>
    <tr>
    <td align="right">
          7839
    </td>
    <td>
    KING
    </td>
    <td>
    PRESIDENT
    </td>
    <td align="right">
    </td>
    <td>
    17-NOV-81
    </td>
    <td align="right">
          5000
    </td>
    <td align="right">
    </td>
    <td align="right">
            10
    </td>
    </tr>
    <tr>
    <td align="right">
          7934
    </td>
    <td>
    MILLER
    </td>
    <td>
    CLERK
    </td>
    <td align="right">
          7782
    </td>
    <td>
    23-JAN-82
    </td>
    <td align="right">
          1300
    </td>
    <td align="right">
    </td>
    <td align="right">
            10
    </td>
    </tr>
    </table>
    <p>
    SQL&gt;which you can spool to a file.

  • Import and export xml file in Oracle

    Hi Gurus,
    Can any one explain , how can we Import and export an XML file in Oracle Please
    Thanks

    Some examples can be found on this {thread:id=410714} forum and also on [Marco&apos;s blog|http://www.liberidu.com/blog/] (He's an Oracle Ace in the {forum:id=34} forum)

Maybe you are looking for

  • I am trying to use 2 MOTU 896's as an aggregate device in Logic Pro 8

    I am using Logic Pro 8 on a Macbook Pro OS 10.6.8.  I am trying to use 2 MOTU 896's as an aggregate device to have total of 16 inputs.  I am daisy chaining the 896's via firewire.  I can select channels 1-16 as inputs in Logic.  I am getting signal i

  • Does Adobe Care Anymore?

    Now that Quark XPress is all but dead (yay!), and there's no other comparable page-layout program, does Adobe really care about their customers? I'm prompted to pose that question since the introduction of InDesign CC and CC2014. I've been using Adob

  • ATI Radeon 9550 (no) accelerating

    Hi. I'm not able to enable acceleration with my Radeon 9550 (R350) card (open driver). Direct rendering seems to be enabled: direct rendering: Yes But: OpenGL vendor string: Mesa Project OpenGL renderer string: Software Rasterizer OpenGL version stri

  • Error Passing an internal table between BSP pages

    Any time there is data in the internal table and I try to pass it from one BSP page to the next I get an Web error.  I've heard that it is possible to pass an internal table from one page to the next.  can anyone point me in the right direction here?

  • Lecture message redondant sur un port serie rs232

    Bonjour, J'ai un système qui m'envoie un message sur le port série toutes les secondes. Donc je viens lire le port série toutes les secondes et j'enregistre les messages dans un fichier texte. Quand je dépouille le fichier je m'aperçois que des fois