How do I import one xml file into 3 separate tables in db?
I need to utilize xslt to import one xml file into 3 separate tables: account, accountAddress, streetAddress
*Notice the missing values in middleName, accountType
sample xml
<account>
<firstName>Joe</firstName>
<middleName></middleName>
<lastName>Torre</lastName>
<accountAddress>
<streetAddress>
<addressLine>myAddressLine1</addressLine>
<addressLine>myAddressLine2</addressLine>
</streetAddress>
<city>myCity</city>
<state>myState</state>
<postalCode>mypostalCode</postalCode>
</accountAddress>
<accountId>A001</accountId>
<accountType></accountType>
<account>
I need the following 3 results in 3 separate xml files in order for me to upload into my 3 tables.
Result #1
<rowset>
<row>
<firstName>Joe</firstName>
<lastName>Torre</lastName>
<accountId>A001</accountId>
<row>
<rowset>
Result #2
<rowset>
<row>
<addressId>1</address>
<city>myCity</city>
<state>myState</state>
<postalCode>myPostalCode</postalCode>
<row>
<rowset>
Result #3
<rowset>
<row>
<addressId>1</addressId>
<addressLineSeq>1</addressLineSeq>
<addressLine>myAddressLine1</addressLine>
<row>
<row>
<addressId>1</addressId>
<addressLineSeq>2</addressLineSeq>
<addressLine>myAddressLine2</addressLine>
<row>
<rowset>
Use XSU to store in multiple tables.
"XSU can only store data in a single table. You can store XML across tables, however, by using the Oracle XSLT processor to transform a document into multiple documents and inserting them separately. You can also define views over multiple tables and perform insertions into the views. If a view is non-updatable (because of complex joins), then you can use INSTEAD OF triggers over the views to perform the inserts."
http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14252/adx_j_xsu.htm#i1007013
Similar Messages
-
How to import a XML file into the document?
Hai,
i had created a table using xml file....
Now i want to import that xml file tabel into the document...
Can any one tell me how to import the xml file into the document?
thanks
senthilHai...
this is senthil...
i'm beginner for creating adobe indesign plugins..
i want to import a html file in the document...
i want to create a table by using html tags and
that table will be imported into the document..
How shall i do it?
can any one plzz explain me? -
How to load a XML file into a table
Hi,
I've been working on Oracle for many years but for the first time I was asked to load a XML file into a table.
As an example, I've found this on the web, but it doesn't work
Can someone tell me why? I hoped this example could help me.
the file acct.xml is this:
<?xml version="1.0"?>
<ACCOUNT_HEADER_ACK>
<HEADER>
<STATUS_CODE>100</STATUS_CODE>
<STATUS_REMARKS>check</STATUS_REMARKS>
</HEADER>
<DETAILS>
<DETAIL>
<SEGMENT_NUMBER>2</SEGMENT_NUMBER>
<REMARKS>rp polytechnic</REMARKS>
</DETAIL>
<DETAIL>
<SEGMENT_NUMBER>3</SEGMENT_NUMBER>
<REMARKS>rp polytechnic administration</REMARKS>
</DETAIL>
<DETAIL>
<SEGMENT_NUMBER>4</SEGMENT_NUMBER>
<REMARKS>rp polytechnic finance</REMARKS>
</DETAIL>
<DETAIL>
<SEGMENT_NUMBER>5</SEGMENT_NUMBER>
<REMARKS>rp polytechnic logistics</REMARKS>
</DETAIL>
</DETAILS>
<HEADER>
<STATUS_CODE>500</STATUS_CODE>
<STATUS_REMARKS>process exception</STATUS_REMARKS>
</HEADER>
<DETAILS>
<DETAIL>
<SEGMENT_NUMBER>20</SEGMENT_NUMBER>
<REMARKS> base polytechnic</REMARKS>
</DETAIL>
<DETAIL>
<SEGMENT_NUMBER>30</SEGMENT_NUMBER>
</DETAIL>
<DETAIL>
<SEGMENT_NUMBER>40</SEGMENT_NUMBER>
<REMARKS> base polytechnic finance</REMARKS>
</DETAIL>
<DETAIL>
<SEGMENT_NUMBER>50</SEGMENT_NUMBER>
<REMARKS> base polytechnic logistics</REMARKS>
</DETAIL>
</DETAILS>
</ACCOUNT_HEADER_ACK>
For the two tags HEADER and DETAILS I have the table:
create table xxrp_acct_details(
status_code number,
status_remarks varchar2(100),
segment_number number,
remarks varchar2(100)
before I've created a
create directory test_dir as 'c:\esterno'; -- where I have my acct.xml
and after, can you give me a script for loading data by using XMLTABLE?
I've tried this but it doesn't work:
DECLARE
acct_doc xmltype := xmltype( bfilename('TEST_DIR','acct.xml'), nls_charset_id('AL32UTF8') );
BEGIN
insert into xxrp_acct_details (status_code, status_remarks, segment_number, remarks)
select x1.status_code,
x1.status_remarks,
x2.segment_number,
x2.remarks
from xmltable(
'/ACCOUNT_HEADER_ACK/HEADER'
passing acct_doc
columns header_no for ordinality,
status_code number path 'STATUS_CODE',
status_remarks varchar2(100) path 'STATUS_REMARKS'
) x1,
xmltable(
'$d/ACCOUNT_HEADER_ACK/DETAILS[$hn]/DETAIL'
passing acct_doc as "d",
x1.header_no as "hn"
columns segment_number number path 'SEGMENT_NUMBER',
remarks varchar2(100) path 'REMARKS'
) x2
END;
This should allow me to get something like this:
select * from xxrp_acct_details;
Statuscode status remarks segement remarks
100 check 2 rp polytechnic
100 check 3 rp polytechnic administration
100 check 4 rp polytechnic finance
100 check 5 rp polytechnic logistics
500 process exception 20 base polytechnic
500 process exception 30
500 process exception 40 base polytechnic finance
500 process exception 50 base polytechnic logistics
but I get:
Error report:
ORA-06550: line 19, column 11:
PL/SQL: ORA-00932: inconsistent datatypes: expected - got NUMBER
ORA-06550: line 4, column 2:
PL/SQL: SQL Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
and if I try to change the script without using the column HEADER_NO to keep track of the header rank inside the document:
DECLARE
acct_doc xmltype := xmltype( bfilename('TEST_DIR','acct.xml'), nls_charset_id('AL32UTF8') );
BEGIN
insert into xxrp_acct_details (status_code, status_remarks, segment_number, remarks)
select x1.status_code,
x1.status_remarks,
x2.segment_number,
x2.remarks
from xmltable(
'/ACCOUNT_HEADER_ACK/HEADER'
passing acct_doc
columns status_code number path 'STATUS_CODE',
status_remarks varchar2(100) path 'STATUS_REMARKS'
) x1,
xmltable(
'/ACCOUNT_HEADER_ACK/DETAILS'
passing acct_doc
columns segment_number number path 'SEGMENT_NUMBER',
remarks varchar2(100) path 'REMARKS'
) x2
END;
I get this message:
Error report:
ORA-19114: error during parsing the XQuery expression:
ORA-06550: line 1, column 13:
PLS-00201: identifier 'SYS.DBMS_XQUERYINT' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
ORA-06512: at line 4
19114. 00000 - "error during parsing the XQuery expression: %s"
*Cause: An error occurred during the parsing of the XQuery expression.
*Action: Check the detailed error message for the possible causes.
My oracle version is 10gR2 Express Edition
I do need a script for loading xml files into a table as soon as possible, Give me please a simple example for understanding and that works on 10gR2 Express Edition
Thanks in advance!The reason your first SQL statement
select x1.status_code,
x1.status_remarks,
x2.segment_number,
x2.remarks
from xmltable(
'/ACCOUNT_HEADER_ACK/HEADER'
passing acct_doc
columns header_no for ordinality,
status_code number path 'STATUS_CODE',
status_remarks varchar2(100) path 'STATUS_REMARKS'
) x1,
xmltable(
'$d/ACCOUNT_HEADER_ACK/DETAILS[$hn]/DETAIL'
passing acct_doc as "d",
x1.header_no as "hn"
columns segment_number number path 'SEGMENT_NUMBER',
remarks varchar2(100) path 'REMARKS'
) x2
returns the error you noticed
PL/SQL: ORA-00932: inconsistent datatypes: expected - got NUMBER
is because Oracle is expecting XML to be passed in. At the moment I forget if it requires a certain format or not, but it is simply expecting the value to be wrapped in simple XML.
Your query actually runs as is on 11.1 as Oracle changed how that functionality worked when 11.1 was released. Your query runs slowly, but it does run.
As you are dealing with groups, is there any way the input XML can be modified to be like
<ACCOUNT_HEADER_ACK>
<ACCOUNT_GROUP>
<HEADER>....</HEADER>
<DETAILS>....</DETAILS>
</ACCOUNT_GROUP>
<ACCOUNT_GROUP>
<HEADER>....</HEADER>
<DETAILS>....</DETAILS>
</ACCOUNT_GROUP>
</ACCOUNT_HEADER_ACK>
so that it is easier to associate a HEADER/DETAILS combination? If so, it would make parsing the XML much easier.
Assuming the answer is no, here is one hack to accomplish your goal
select x1.status_code,
x1.status_remarks,
x3.segment_number,
x3.remarks
from xmltable(
'/ACCOUNT_HEADER_ACK/HEADER'
passing acct_doc
columns header_no for ordinality,
status_code number path 'STATUS_CODE',
status_remarks varchar2(100) path 'STATUS_REMARKS'
) x1,
xmltable(
'$d/ACCOUNT_HEADER_ACK/DETAILS'
passing acct_doc as "d",
columns detail_no for ordinality,
detail_xml xmltype path 'DETAIL'
) x2,
xmltable(
'DETAIL'
passing x2.detail_xml
columns segment_number number path 'SEGMENT_NUMBER',
remarks varchar2(100) path 'REMARKS') x3
WHERE x1.header_no = x2.detail_no;
This follows the approach you started with. Table x1 creates a row for each HEADER node and table x2 creates a row for each DETAILS node. It assumes there is always a one and only one association between the two. I use table x3, which is joined to x2, to parse the many DETAIL nodes. The WHERE clause then joins each header row to the corresponding details row and produces the eight rows you are seeking.
There is another approach that I know of, and that would be using XQuery within the XMLTable. It should require using only one XMLTable but I would have to spend some time coming up with that solution and I can't recall whether restrictions exist in 10gR2 Express Edition compared to what can run in 10.2 Enterprise Edition for XQuery. -
1. Is there a way to import large XML files into HANA efficiently?
2. Will it process it node by node or the entire file at a time?
3. Are there any data services provided to do this?
This for a project use case i also have an requirement to process bulk XML files, suggest me to accomplish this taskHi Patrick,
I am addressing the similar issue. "Getting data from huge XMLs into Hana."
Using Odata services can we handle huge data (i.e create schema/load into Hana) On-the-fly ?
In my scenario,
I get a folder of different complex XML files which are to be loaded into Hana database.
Then I gotta transform & cleanse the data.
Can I use oData services to transform and cleanse the data ?
If so, how can I create oData services dynamically ?
Any help is highly appreciated.
Thank you.
Regards,
Alekhya -
How to convert xml file into internal table in ABAP Mapping.
Hi All,
I am trying with ABAP mapping. I have one scenario in which I'm using below xml file as a sender from my FTP server.
<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:MTO_ABAP_MAPPING xmlns:ns0="http://Capgemini/Mumbai/sarsingh">
<BookingCode>2KY34R</BookingCode>
- <Passenger>
<Name>SARVESH</Name>
<Address>THANE</Address>
</Passenger>
- <Passenger>
<Name>RAJESH</Name>
<Address>POWAI</Address>
</Passenger>
- <Passenger>
<Name>CARRON</Name>
<Address>JUHU</Address>
</Passenger>
- <Flight>
<Date>03/03/07</Date>
<AirlineID>UA</AirlineID>
<FlightNumber>125</FlightNumber>
<From>LAS</From>
<To>SFO</To>
</Flight>
</ns0:MTO_ABAP_MAPPING>
AT the receiver side I wnat to concatenate the NAME & ADDRESS.
I tried Robert Eijpe's weblog (/people/r.eijpe/blog/2005/11/21/xml-dom-processing-in-abap-part-ii--convert-an-xml-file-into-an-abap-table-using-sap-dom-approach)
but couldnt succeed to convert the xml file into internal table perfectly.
Can anybody help on this.
Thanks in advance!!
SarveshHi Sarvesh,
The pdf has details of ABAP mapping. The example given almost matches the xml file you want to be converted.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/3.0/how to use abap-mapping in xi 3.0.pdf
Just in case you have not seen this
regards
Vijaya -
How do I import an MKV file into Premiere Pro CS6?
How do I import an MKV file into Premiere Pro CS6?
Premiere Pro CS6 doesn't support MKV formats. To import MKV to Premiere Pro CS6, a recommended solution is to convert MKV to AVI.
I've been reading so many different forums on how to convert MKV to AVI. Finally, I summarised three solutions:
First one: HandBrake . This tool is a free and open-source multi-threaded transcoding app. It supports nearly any videos including MKV format and has Mac version and Windows version.
Cons:
1. HandBrake is too professional to handle for most people;
2. It doesn't support MOV as output format.
Second one: there are many third party software which supports converting MKV to AVI. I just test one of them. It's professional yet easy to use and the service is excellent. And there is a step by step guide about how to use this tool .
Cons:
1. Most of them are not free.
Third one: Online-Converter . This kind of converter does a great job on file conversion.
Cons:
1. Like most online converters, the free version of this tool only allows you to convert videos smaller than 100MB. It's too small for video conversion;
2.Your MKV video should be upload to the internet to be converted. This means the risk of pravite information leak is possible. -
How do I import an iMove file into Toast 7?
How do I import an iMovie file into Toast 7? I have tried
the image file copy and the horizontal
aliasing still is there.I am not quite sure what you are trying to do since you mention copying an image file. Let's start with an iMovie project and you now want to encode it. You have a choice of programs to do the encoding, Toast being one of them. If the video is less than 2 hours, iDVD offers more options and does a great job encoding the movie too. I use both programs. If this is the process you are trying to follow, then Toast 7 allows you to drag the iMovie project file directly into the Toast window (after selecting the Video tab)and it will locate the right file to encode. Set the various options for menus, etc. and then go. Usually, it is best to Save As Disc Image, and then burn the DVDs later from the image file again with Toast using the Copy tab (copy image file selection). If I create the image file with iDVD, I still use Toast to burn the DVDs. Toast 7 works great with iMovie 5, but I have not used it with iMovie 6. There could be some incompatibilities.
-
How can I import MP3 audio files into premiere pro cs5?
Can any one help?
How can I import MP3 audio files into premiere pro cs5?It is really difficulty for me.If you still haven't found a satisfactory answer,please search it on google.Hope you can get your answer as soon as quickly!
fifa 14 coins
cheap fifa coins -
How do I import a music file into garage band ?
How do I import a music file into garage band ? It is shown as MP3 but will not play in Garage band, It will play in QuickTime 7
worldtripper wrote:
All my other songs play , but not this one.
convert it:
http://www.bulletsandbones.com/GB/GBFAQ.html#neverfail
(Let the page FULLY load. The link to your answer is at the top of your screen) -
Importing data- using xml file into HANA Table
Hi,
We are using (HDB STUDIO ) - revision 60.......
Is it possible to import data using XML file into HANA table (Master,Fact tables)?
(Without using any intermediate adapters for conversion of data.....)
Can any one suggest us........
Thank you.Hi user450616
I am a bit confused about what you are trying to achieve.
Are you:
1. importing a CSV file into APEX
2. adding an extra column to the Oracle Table
3. populating the extra column with the CSV filename?
Let us know if this is what you are trying to do.
Cheers,
Patrick Cimolini -
How to load a XML file into a table using PL/SQL
Hi Guru,
I have a requirement, that i have to create a procedure or a package in PL/SQL to load XML file into a table.
How we can achive this.ODI_NewUser wrote:
Hi Guru,
I have a requirement, that i have to create a procedure or a package in PL/SQL to load XML file into a table.
How we can achive this.
Not a perfectly framed question. How do you want to load the XML file? Hoping you want to parse the xml file and load it into a table you can do this.
This is the xml file
karthick% cat emp_details.xml
<?xml version="1.0"?>
<ROWSET>
<ROW>
<EMPNO>7782</EMPNO>
<ENAME>CLARK</ENAME>
<JOB>MANAGER</JOB>
<MGR>7839</MGR>
<HIREDATE>09-JUN-1981</HIREDATE>
<SAL>2450</SAL>
<COM>0</COM>
<DEPTNO>10</DEPTNO>
</ROW>
<ROW>
<EMPNO>7839</EMPNO>
<ENAME>KING</ENAME>
<JOB>PRESIDENT</JOB>
<HIREDATE>17-NOV-1981</HIREDATE>
<SAL>5000</SAL>
<COM>0</COM>
<DEPTNO>10</DEPTNO>
</ROW>
</ROWSET>
You can write a query like this.
SQL> select *
2 from xmltable
3 (
4 '/ROWSET/ROW' passing xmltype
5 (
6 bfilename('SDAARBORDIRLOG', 'emp_details.xml')
7 , nls_charset_id('AL32UTF8')
8 )
9 columns empno number path 'EMPNO'
10 , ename varchar2(6) path 'ENAME'
11 , job varchar2(9) path 'JOB'
12 , mgr number path 'MGR'
13 , hiredate varchar2(20)path 'HIREDATE'
14 , sal number path 'SAL'
15 , com number path 'COM'
16 , deptno number path 'DEPTNO'
17 );
EMPNO ENAME JOB MGR HIREDATE SAL COM DEPTNO
7782 CLARK MANAGER 7839 09-JUN-1981 2450 0 10
7839 KING PRESIDENT 17-NOV-1981 5000 0 10
SQL> -
A query while importing an XML file into a Database Table
Hi,
I am Creating an ODI Project to import an XML file into a Database Table.With the help of the following link
http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_11g/odi_project_xml-to-table/odi_project_xml-to-table.htm
I am facing a problem while creating Physical Schema for the XML Source Model.
For the
Schema(Schema)
and
Schema(Work Schema) field they have selected GEO_D.
What is GEO_D here??
or
What I have to select here?
1) schema of the xml file (NB:-I havn't created any .xsd or .dtd file for my .xml file)
or
2)my target servers schema
Please tell me what I'll do??
Thanksand
Schema(Work Schema) field they have selected GEO_D.
What is GEO_D here??This is the schema name which is specified in the XML file .
What I have to select here?
1) schema of the xml file (NB:-I havn't created any .xsd or .dtd file for my .xml file)Yes
2)my target servers schema
Please tell me what I'll do??
Thanks -
How do I import a .fcpproject file into final cut pro?
How do I import a .fcpproject file into final cut pro?
You don't. The application opens it when it recognizes it in the correct folder structure.
-
CANNOT IMPORT FCP .XML FILE INTO PREMIERE PRO CS5
Hi,
Camera used:-Sony Pmw Ex3
Footage :- XDCAM sp(1440 * 1080i) PAL
Edited in :-final cut pro 7
Error :- failed to import .xml file into premiere pro cs5
I tried to import the .xml file into premiere CS5 ,it asked for the media files to relink .whn i linked the .mp4 files it showed the error messege "The selected file cannot be linked becouse it has 2 audio channel(s) and the clip was created with 1 audio channel(s).
then i tried to relink the .mov instead of .mp4 file (which i used in final cut pro on apple machine)i got the error "Codec missing or unavailable"
what should i do???..i almost done all the editing in final cut pro and i bought the adobe coz i thought i can finish all the pending FCP projects in Premier Pro..??What is the CODEC in your MOV file(s)? MOV is but a "wrapper," like AVI. This ARTICLE will give you some background. It could be that you just need the proper CODEC, or it could be that it is a Mac-only CODEC, and then you will need for the producer to Export in another CODEC, that is PC-compatible.
This ARTICLE will give you some background on CODEC's, in general.
Good luck,
Hunt -
How do i import director 7 files into current premiere pro
how do i import director 7 files into current premiere pro
I have a project created in Macromedia Director 7. I was told by sales that this would import into Premere Pro.
However I have no Idea how! Any help would be appreciated.I'm happy to announce to you all that my "mp4 importing" issues has been sorted out. Now I import mp4 shot with the same Windows Phone 8 Device into Adobe Premiere Pro CS4. Only that for the moment, it doesn't play as fast as with ordinary player.
But how did I get it to work, you may wonder;
I simply installed Itunes on the system, I also installed an app called media monkey. I can't say which of the apps did the magic but the next time I tried to import mp4 files into Premiere Pro after these installations, it imported seamlessly.
Obviously there's a link between the required codecs and the itunes itself.
You may want to try it and hope it works for you.
Kindly inform us if it works.
Thank you all.
Cheers.
Maybe you are looking for
-
Hello I have a neat little Java applet menu and would like a link from the menu to open up a pop up window in another frame. I know this can be done in Java, but is there any information anywhere which I could read to show me how to do it? Basically,
-
Dual monitor stopped working after Mavericks installed
27-inch Mid 2010 iMac - upgraded to Mavericks, now LG monitor gives "no signal" error message. LG model is 27EA83, connection is via DisplayPort. It worked before (Lion) and also works with MBPro upgraded to Mavericks. The iMac recognizes the monitor
-
I have Photoshop Elements 11, downloaded with a serial number. I have now upgraded my computer. Can I load that version to my new computer?
-
I'm curious as to if anybody has some insight to killed sessions. I have a procedure that looks like this: procedure x lv_result number; lv_msg varchar2(4000); for x in cursor loop lv_result := NULL; lv_msg := NULL; begin ex
-
After waking up from Hibernation: Wireless mouse and k'board dont work!!
Hi All My second issue with my iMac, otherwise been a good experience. This is the annoying one. Sometime, or i should say most of the time, when the iMac wakes up from Windows XP hibernation, the mouse and the k'board (both bluetooth wireless) decid