Insert xml files into the table

Hi all

How to create an application, which allows me to download an xml file and insert the file into a table, looking something like what makes the apex, with 'data-> data-> Data Load XML Workshop'.

I tried to create it using this link https://forums.Oracle.com/message/9170494 # 9170494

but when loading the file and send it (current executing the "sp") sends the error "ORA-22285: file for FILEOPEN operation or non-existent directory.

I could slightly auxiliary

concerning

This idea is troubling for me.

The XML file DOES NOT CHANGE.  This is the goal.  You have a DTD/XST that defines where in the XML hierarchy, a data element is and (so) how to access it.  With this information, you can hardcode things.

Therefore, you should have no reason for that functionality 'map the data column in the table column"of the data loader since all mappings will be always the same.

As a simple INSERT... The SELECT statement can (and should) be used.

(use the FUSION if you update / insert data).

I copy + paste some of my code in a procedure that I use.

You will need to replace the parameter name (p_filename) with the value of appropriate link (name of item)

  declare
    l_XML XMLType;
  begin
    /* get file from APEX WWV_FLOW_FILES */
    begin
        select XMLType( blob_content, 1 ) -- 1 means that the file is USACII encoded. this may need to be changed.
          into l_XML
        from wwv_flow_files where name = p_filename; -- replace this with the appropriate ITEM NAME
    exception
      when no_data_found then
        raise_application_error( -20001, 'not in FLOW: ''' || p_filename || '''' );
    end;

    /* you'll need to figure this one out */
    INSERT INTO T (...)
    SELECT ..
    FROM  XMLTable( '/'
pasing l_xml
            columns
                   PATH  -- repeat for each "column" you want to extract
        );

   delete from wwv_flow_files where name=p_filename;
  end;

Tags: Database

Similar Questions

  • Impossible to insert xml data into the table

    HII All,
    I'm unable to parse the following xml file and insert them into the table.


    Version of DB
    ======
    SQL> SELECT *
      2  FROM V$VERSION;
    
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE    10.2.0.4.0      Production
    TNS for Solaris: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    My DB Table
    Create table rgh_xml_storage
    (
    user_id       varchar2(4000),
    to_type          varchar2(4000),
    mail_id          varchar2(4000),
    subject         varchar2(4000),
    sentDateTime    varchar2(4000)
    )
    Published by: RUSSO April 7, 2011 04:19

    Hello

    Please provide all pertinent details!

    Please correct my insert if statement it must be.

    You have a few bad XPath.
    Here's a way to unnest correctly repeated elements:

    SQL> select x1.user_id,
      2         x1.subject,
      3         x1.sentDateTime,
      4         x2.to_type,
      5         x2.mail_id
      6         --x1.messageBody
      7  from xmltable(
      8    '/emailMessage'
      9    passing xmltype(bfilename('TEST_DIR','email.xml'), nls_charset_id('CHAR_CS'))
     10    columns user_id      varchar2(4000)  path 'headerInformation/sender/user/@userID',
     11            subject      varchar2(4000)  path 'headerInformation/subject',
     12            sentDateTime varchar2(4000)  path 'headerInformation/sentDateTime',
     13            messageBody  clob            path 'messageBody',
     14            my_xml       xmltype         path 'headerInformation/recipients'
     15   ) x1,
     16   xmltable(
     17    '/recipients/recipient'
     18    passing x1.my_xml
     19    columns to_type      varchar2(4000)  path '@type',
     20            mail_id      varchar2(4000)  path 'user/@emailAddress'
     21   ) x2
     22  ;
    
    USER_ID              SUBJECT                                          SENTDATETIME                   TO_TYPE   MAIL_ID
    -------------------- ------------------------------------------------ ------------------------------ --------- ------------------------------------------
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   to        [email protected]
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   cc        [email protected]
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   cc        [email protected]
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   cc        [email protected]
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   cc        [email protected]
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   cc        [email protected]
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   cc        [email protected]
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   bcc       [email protected]
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   bcc       [email protected]
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   bcc       [email protected]
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   bcc       [email protected]
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   bcc       [email protected]
    RC58522              Re: CAA - Schlesinger ' Arnold   - LP01115771    Fri Oct 10 13:31:53 EDT 2010   bcc       [email protected]
    
    13 rows selected
     
    
  • Error when inserting XML file into a table in Oracle10g

    Hi team,

    I'm trying to insert an xml file into an Oracle 10g XMLType table. During the insertion, I get following error:

    ERROR on line 1:
    ORA-22285: non-existent directory or file for FILEOPEN operation
    ORA-06512: at "SYS." DBMS_LOB", line 523
    ORA-06512: at "SYS." XMLTYPE", line 287
    ORA-06512: at line 1

    I did following steps.

    (1) create the DIRECTORY xml_dir as 'c:\xmldata ';

    (2) create table xmltab XMLType;

    The following packages are executed by schema 'Sys '.

    (1) dbmslob. SQL;
    (2) prvtlob. PLB;

    A xmldata folder is created under "c:\". "and with data_file.xml file is stored in it.

    After Insert stmt is executed that returns gives above error.

    Insert in xmltab values (XMLType (bfilename('xml_dir','data_file.xml'), nls_charset_id ('AL32UTF8')))


    Can you please give me a solution. It is very urgent.

    Thanks in advance.

    Kind regards
    Murielle

    After selecting the data in table xmltab I just got first line of the file xmldata. That is to say
    http://baro

    This must be a display problem.
    What client tool are you using and what version?

    If SQL * Plus, you won't see all content unless you set some options:
    {code}
    LONG VALUE
    SET LONGCHUNKSIZE
    {code}

    Could you try the following?
    {code}
    THE VALUE OF 10000 LONG

    SELECT t.object_value.getclobval () IN xmltab t;

    -to force printing:
    SELECT extract (t.object_value, ' / *'). getclobval() xmltab t;
    {code}

    Published by: odie_63 on 16 Feb. 2011 08:58

  • Insert .xml file into xmltype table?

    Hi experts,

    I'm in I'm in Oracle Enterprise Manager 11 g 11.2.0.1.0.
    SQL * more: Production of release 11.2.0.1.0 killed him Feb 22 11:40:23 2011

    Thank you!

    My an .xml file is listed below:
    <? XML version = "1.0" encoding = "UTF-8"? > <? XML-stylesheet href = "http://www.accessdata.fda.gov/spl/stylesheet/spl.xsl" type = "text/xsl"? >
    "< document xmlns =" "urn: hl7 - org:v3" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi: schemaLocation = "urn: hl7 - org:v3 http://localhost:8080/home/DEV/xsd/spl.xsd" & gt;
    < / value >
    < / observationMedia >
    < / component >
    < / section >
    < / component >
    < / structuredBody >
    < / component >
    < / document >

    Published by: cow on April 4, 2011 12:59

    Published by: cow on April 4, 2011 14:06

    so I can also rely on this DOCUMENT2 to create relational views?

    Yes.

  • Insert XML data from the Table-&gt; back to null

    Dear Experts,

    -I have table xml as below:

    Example of CREATE TABLE (XML_spec XMLTYPE);

    Insert in the example
    Select ' < name of Message = "dataStaticInvestor" type = "IncomingMessage" >
    < name of field = "batchReference" > OPENINGBATCH000000 < / field > < List name = "data" >
    < = record name "data" >
    < name of field = "externalReference" > 01234567890aaaaaaa < / field >
    < name of field = "participantID" > OD001 < / field >
    < name of field = "participantName" > EQUITY SECURITIES INDONESIA, PT < / field >
    < / recording >
    < = record name "data" >
    < name of field = "externalReference" > 01234567890aaaaaaa < / field >
    < name of field = "participantID" > OD001 < / field >
    < name of field = "participantName" > EQUITY SECURITIES INDONESIA, PT < / field >
    < / recording >
    < = record name "data" >
    < name of field = "externalReference" > 01234567890aaaaaaa < / field >
    < name of field = "participantID" > OD001 < / field >
    < name of field = "participantName" > EQUITY SECURITIES INDONESIA, PT < / field >
    < / recording >
    < / list >
    < / message > ' double.

    Select * example;

    create table hasil1 (c1 varchar2 (500), c2 varchar2 (500), c3 varchar2 (500));

    -This step I create the procedure to insert xml data into the table as the batch.

    DECLARE
    x XmlType;
    BEGIN
    Select XML_SPEC in x for example;

    insert into hasil1
    SELECT
    p.Extract('/Record/Field/@externalReference').getstringval (C1),
    p.Extract('/Record/Field/@participantID').getstringval (C2),
    p.Extract('/Record/Field/@participantName').getstringval () as c3
    TABLE (XMLSequence (Extract(x,'Message/List/Record'))) p;
    commit;
    END;
    /

    -when the result of select hasil1, the output is back 3 rows and 3 columns, but all data is a null *.

    Best regards
    Sigcle

    You don't explain what output you need, but I guess something like this:

    SQL> insert into hasil1 (c1, c2, c3)
      2  select x.c1, x.c2, x.c3
      3  from example t
      4     , xmltable(
      5         'Message/List/Record'
      6         passing t.xml_spec
      7         columns c1 varchar2(500) path 'Field[@name="externalReference"]'
      8               , c2 varchar2(500) path 'Field[@name="participantID"]'
      9               , c3 varchar2(500) path 'Field[@name="participantName"]'
     10       ) x
     11  ;
    
    3 rows inserted
    
    SQL> select * from hasil1;
    
    C1                     C2        C3
    ---------------------- --------- --------------------------------
    01234567890aaaaaaa     OD001     EQUITY SECURITIES INDONESIA,PT
    01234567890aaaaaaa     OD001     EQUITY SECURITIES INDONESIA,PT
    01234567890aaaaaaa     OD001     EQUITY SECURITIES INDONESIA,PT
     
    
  • Error when inserting XML Date in the Table

    Hi all

    I am working on Oracle 11 g and trying to insert a date XML in the table but get error - below

    Query - insert into TableName (ID, CREATION, CREATEDBY) VALUES (50, *'2010 - 12-15 T 12: 57:19'*, 'Name')

    Error - java.sql.SQLDataException: ORA-01861: literal does not match the format string

    CREATED column datatype is Date

    When I try to use sysdate instead of hard-coding XML date of obtaining inserted successfully into the table. Please let me know how to pass this XML format date.

    Thanks in advance.

    Concerning
    Nikhil

    I don't see any XML in what you posted. In any case:

    "2010 12-15 T 12: 57:19'.

    is a string, not a date. Use:

    to_date('2010-12-15T12:57:19','YYYY-mm-dd"T"HH24:mi:SS')

    For example:

    SQL> create table tbl(created date);
    
    Table created.
    
    SQL> insert into tbl values('2010-12-15T12:57:19');
    insert into tbl values('2010-12-15T12:57:19')
                           *
    ERROR at line 1:
    ORA-01861: literal does not match format string
    
    SQL> insert into tbl values(to_date('2010-12-15T12:57:19','YYYY-MM-DD"T"HH24:MI:SS'))
      2  /
    
    1 row created.
    
    SQL> 
    

    SY.

  • Load xml data into the table

    Hi all

    I have an XML (emp.xml) with data below:

    -< root >
    -< row >
    < name > steve < / lastname >
    < 30 > < / Age >
    < / row >
    -< row >
    < name > Paul < / lastname >
    <>26 < / Age >
    < / row >
    < / root >

    I would like to create a stored procedure to store the xml data into the EMP table.

    EMP
    LastName age
    Steve 30
    Paul 26

    I tried to watch all threads related to this forum, but cannot find the right wire. Any help is greatly appreciated. Thank you

    With

    SQL>  select * from xmltable('root/row' passing xmltype('
    
    steve
    30
    
    
    Paul
    26
    
    ') columns lastname path 'lastname',
                       Age path 'Age')
    /
    LASTNAME   AGE
    ---------- ----------
    steve      30
    Paul       26   
    

    You can now just make a

    Insert into emp as select...

  • APEX 5: FILE item type to BROWSE not load file into the table apex_application_temp_files

    Hello

    I am trying to load the BLOB (CSV file) into apex_application_temp_files table using the file_browse item type. I have created an example page and the added element of type file_browse, added a dynamic action, which send item to browse.

    Also added a button load that submits the page. But when I check the apex_application_temp_files of APEX sql workhop table, nothing appears.

    I purge file to "end of Session. Enclosed screen shot as well.Capture.PNG

    Thank you

    Ankit

    Hi Pierre,.

    has added a dynamic action, submitting travel item.

    How can you submit just the element go? How your dynamic action look like?

    But when I check the apex_application_temp_files of APEX sql workhop table, nothing appears.

    It is by design, because the sight of apex_application_temp_files limited to your current session. In your case at the session of constructor and not your application.

    Add a process to the page that contains the item "Browse file" when you use

    select *
      from apex_application_temp_files
     where name = :page item name;
    

    to access your downloaded BLOB.

    Concerning

    Patrick

  • Insert a row into the table on a button click

    Hi all

    I have a table called 'temp' with 4 columns such as seq, name, event, id and I have a GP with 3 text such as name, event id fields

    now my question is

    If I enter values in the 3 text fields on this page and a button, click on (for example create), I wanted the values of dose to get inserted into the table 'temp' and

    regarding, "seq" column I HAV created a sequence for it.

    so 1. How to insert values into the table by entering the values in the page

    2 wat shd b made to column seq... (shd b anyth made apex pages or wil automatically get values for each input line)

    pls help me...

    Thanks in advance

    1, it is up to you change your account to something more user-friendly than '8f4692cc-040e-48ee-b102-590cdd4303fc'.

    Then, it would also be a good idea to use proper English when you ask a question here...  Not broken English as "now comes to my" and "wat shd b"... More people will be willing to help you if you at least put forward in order to ask a good question...

    Which version of the database are you using? APEX version?

    Change the code above to this process:

    DECLARE

    v_seq NUMBER;

    BEGIN


    Select SEQUENCE_NAME. NEXTVAL INTO v_seq

    Double;


    INSERT INTO temp (seq, name, event, id)

    VALUES (v_seq,: P1_name,: P1_event,: P1_id);

    END;


    This allows it to be used in older versions of Oracle that do not allow direct access to the sequence.nextval in an assignment statement.


    Thank you


    Tony Miller

    Software LuvMuffin

  • Insert data in single file into the table of multiples

    Hello

    I have a data file something like this
    C, 2, 10, 10.
    D,,,new,1002,27-Jun-2008,USD,27-Jun-2008,2047,A,MTL,inventory,0001,,,10,,27-Jun-2008,001,,,2047,
    D,,,new,1002,28-Jun-2008,USD,27-Jun-2008,2047,A,MTL,inventory,0001,,,10,28-Jun-2008,001,,,2047,

    where the first line
    -> C, 2, 10, 10, is the control register which is in table 1

    and all other records IE
    D,,,new,1002,27-Jun-2008,USD,27-Jun-2008,2047,A,MTL,inventory,0001,,,10,,27-Jun-2008,001,,,2047,
    D,,,new,1002,28-Jun-2008,USD,27-Jun-2008,2047,A,MTL,inventory,0001,,,10,28-Jun-2008,001,,,2047,

    enter the table 2.


    How can achieve us this by using the File/FTP adapter and adapter DB?


    Thank you

    Sunil

    1 1 creer create the FileAdapter/FtpAdapter, set nativce schema for your delimited file
    2. create a DBAdapter for Table1
    3. create a DBAdapter to Table2
    4 drag to transform two activity and create two xsl map, one with each on the array element 2 which pass through each element D of the Source variable and the second with transformation simple to assign control register values to the elements of table 1

    HTH

  • Import an XML file into flat table

    Yhe, I am completely new to XML and I try to import a file into a flat table.
    I import a file with the xsd:
    https://www.ediel.se/EdielPortal/service/CompanyExport.xsd
    I am writing a question as simple as possible, but I'm stuck.

    SELECT *.
    FROM XMLTABLE ('/ firms/market/society ' PASSAGE)
    XMLTYPE (bfilename ('SVK_COMPANIES', 'test.xml'), nls_charset_id('ISO-8859-1'))
    COLUMNS
    path of varchar2 (60) namn "name."
    ["path of varchar2 (5) edielno ' IdentificationKeys/Key[@Type="EdielId ']',
    ["path of VARCHAR2 (3) svkid ' IdentificationKeys/Key[@Type="SvKId ']',
    ["path of varchar2 (1) typ_n ' Roles/Role[@Type="Netowner ']',
    ["path of varchar2 (1) typ_b ' Roles/Role[@Type="BalanceResponsible ']',
    ["path of varchar2 (1) typ_l ' Roles/Role[@Type="PowerSupplier ']',
    ["path of varchar2 (1) typ_o ' Roles/Role[@Type="ASP ']',
    path number (5.0) "BusinessFunctions/BusinessFunction[Type="PRODAT"]/@PartyId," prodat_ombud
    "[" path of varchar2 (200) email_prodat ' BusinessFunctions/BusinessFunction[Type="PRODAT"]/CommunicationAddress[@Type="SMTP ']"
    )

    The first works well, but does not work the last two. What I am doing wrong?

    A few typos I guess?

    You are missing the accessor of the attribute ' @' for the Type and the other wrong added on PartyId

    path number (5.0) "BusinessFunctions/BusinessFunction[@Type="PRODAT"]/@PartyId," prodat_ombud

    "[" path of varchar2 (200) email_prodat ' BusinessFunctions/BusinessFunction[@Type="PRODAT"]/CommunicationAddress[@Type="SMTP ']"

    SELECT *
    FROM XMLTABLE('/Companies/Market/Company'
      PASSING XMLTYPE(bfilename('TEST_DIR', 'test.xml'), nls_charset_id('WE8ISO8859P1'))
      COLUMNS
        namn         varchar2(60) path 'Name',
        edielno      varchar2(5)  path 'IdentificationKeys/Key[@Type="EdielId"]',
        svkid        varchar2(3)  path 'IdentificationKeys/Key[@Type="SvKId"]',
        typ_n        varchar2(1)  path 'Roles/Role[@Type="Netowner"]',
        typ_b        varchar2(1)  path 'Roles/Role[@Type="BalanceResponsible"]',
        typ_l        varchar2(1)  path 'Roles/Role[@Type="PowerSupplier"]',
        typ_o        varchar2(1)  path 'Roles/Role[@Type="ASP"]',
        prodat_ombud number(5)     path 'BusinessFunctions/BusinessFunction[@Type="PRODAT"]/PartyId',
        email_prodat varchar2(200) path 'BusinessFunctions/BusinessFunction[@Type="PRODAT"]/CommunicationAddress[@Type="SMTP"]'
    ) ;
    
    NAMN                                                         EDIELNO SVKID TYP_N TYP_B TYP_L TYP_O PRODAT_OMBUD EMAIL_PRODAT
    ------------------------------------------------------------ ------- ----- ----- ----- ----- ----- ------------ ----------------------------------------------
    Ellevio AB                                                   14900   006   1     0     0     0            14900 [email protected]
    
  • How to insert a row into the table from an entity class

    I use JDeveloper 11.1.2.3.0 using ADF.  I would like to insert a row in Table B, when A table is inserted into the database based on a value selected by the end user.  I could do in a database trigger, but I would try in the ADF. I think that the best place to do it would be in the entity based on the table A class. I could override the doDML method and search for DML_INSERT

    and make the table insert B here, but I don't know the best way to achieve this.  I guess I want to avoid using a SQL "insert". I'm new to ADF and it can be difficult to get

    a question using the appropriate terminology. I hope this makes sense.

    Hello

    Check out this blog: http://andrejusb.blogspot.com/2008/02/complex-insert-in-easy-way.html

    Arun-

  • Insert a logo into the table of contents?

    is it possible to insert a logo at the top or bottom of the table of contents (in the skin editor)?

    Thank you

    clemency

    Hello

    Please, what version are you using: Captivate® 5 or Captivate 4?

    If it's the CP5, open the Info button in the Table of contents dialog, there's a button where you can download a 'photo', but you can use it for images, even for a video:

    Lilybiri

  • Insert XML data into the MySQL database

    Hi all, I'm new with XML and I need help with the insertion of XML data in the mysql database using coldfusion. I looked on the Coldfusion Documentation and saw how to convert XML to a Coldfusion query... but there was no example of how to do an insert. If anyone can give me a good example or point me towards a good direction on how to do it, I would really appreciate it.

    Thank you very much in advance
    Alfie

    Nevermind, I finally managed to do work!

  • Load the XML file into oracle using sql loader

    Hello

    I'm trying to load an xml file into a table using sqlldr.
    I have a table as follows:
    CREATE TABLE xmlloadtable
    ( id number,
     data_xml XMLType
     )
      XmlType data_xml STORE AS CLOB;
    I have a control file that I know is perfectly false:
    LOAD DATA 
    INFILE '/home/oraread/'
    INTO TABLE xmlloadtable 
    (
    id,
    data_xml 
    )
    I googled for the file control and tried in different ways, but of no use.
    I want to load the entire xml file into the table.
    Can someone help me with the correct control file. Any help is appreciated!

    Try this

    LOAD DATA
    INFILE '/home/oraread/'
    INTO TABLE xmlloadtable
    (id,
     file_name          filler,
     data_xml          lobfile(file_name) terminated by eof
    )
    

    You can add the file as a column name field to your table between the id and xml column and remove the word to fill in the .ldr file if you need to keep the name of the file

Maybe you are looking for