How to load the .xml file list from 'C:\Drag_list\Modified' into xmltype tb
Hi all experts,
I am in Oracle Enterprise Manager 11g 11.2.0.1.0.
SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 22 11:40:23 2011
is there anyone know why
SQL> create or replace directory XMLDIR as '/xdb/faq/testdata'
2 /
SQL> set long 10000 pages 200 lines 150
SQL> --
SQL> select xmltype(bfilename('XMLDIR','2003.xml'),nls_charset_id('AL32UTF8'))
2 from dual
worked. but
SQL> create or replace directory XMLDIR as 'C:\Drag_list\Modified';
SQL> select xmltype(bfilename('XMLDIR','2011.xml'),nls_charset_id('AL32UTF8'))
from dual
did not work?
IS there any way I can load the .xml file list from 'C:\Drag_list\Modified' into xmltype table?
Thanks.
did not work?Generally we'll need a bit more info than "it didn't work", was there an ora-X error message? What was the error?
Assuming you're on *nix a 'C:\<folder name>\...' directory spec just plain won't work, the directory has to point to a valid storage location on the database server host.
Try a host command (at the database server) and make sure the .xml file name and location is valid, in sqlplus a "bang" (exclamation) runs a host command, i.e.:
SQL> !ls -l /xdb/faq/testdata
... usr grp ... 2003.xml
...But if you are on windows, its the `host` command:
SQL> host dir c:\drag_list\modified
mm/dd/yyyy ... 2011.xml
... The create directory ... as ... must point to a valid storage location for it to work, at least that is step one.
Similar Messages
-
Hi all experts,
I am in Oracle Enterprise Manager 11g 11.2.0.1.0.
SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 22 11:40:23 2011
is there anyone know why
SQL> create or replace directory XMLDIR as '/xdb/faq/testdata'
2 /
SQL> set long 10000 pages 200 lines 150
SQL> --
SQL> select xmltype(bfilename('XMLDIR','2003.xml'),nls_charset_id('AL32UTF8'))
2 from dual
worked. but
SQL> create or replace directory XMLDIR as 'C:\Drag_list\Modified';
SQL> select xmltype(bfilename('XMLDIR','2011.xml'),nls_charset_id('AL32UTF8'))
from dual
did not work?
IS there any way I can load the .xml file list from 'C:\Drag_list\Modified' into xmltype table?
Thanks.
Edited by: Cow on Apr 13, 2011 12:58 AMThis is a question better suited for the sql and pl/sql support forum, since it is NOT an APEX based question..: PL/SQL
Thank you,
Tony Miller
Webster, TX
On the road of life...There are 'windshields', and there are 'bugs'
(splat!)
"Squeegees Wanted"
If this question is answered, please mark the thread as closed and assign points where earned.. -
How to load the XML file to BW3.5
Hi Gurus,
i am following the steps for extracting the data from XML to 3.5 following the steps in the HOWTOSENDXMLDATATOBW.doc. i have a doubt at the 22 nd Point where in the document given that jump to point 26 for 3.5 version. But where we need to specify the path of the XML file. Used the Tcode WSADMIN to test the Webservices, but i am unable to load the delta due to the above problem. what are the steps i need to follow in WSADMIN. We are using SOAPservice in BW.
Please help me for finding the soluction for XML loading of the delta data to BW.
Thanks,
James
Message was edited by:
james winsletHi,
I am sending you a link that will provide you with some good idea on XML File Uploading....
How to upload XML flat file
Hope this helpful... award points
regards,
raj
Message was edited by:
gangaraju mullapudi -
How to customize the XML file name from user entered field value when submitting
How can I customize the name of an HTTP submitted XML file from data entered by the user in a text field?
The field in question contains user identification information and would ease the sorting of files received for easy identification.
Thank you,How can I customize the name of an HTTP submitted XML file from data entered by the user in a text field?
The field in question contains user identification information and would ease the sorting of files received for easy identification.
Thank you, -
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> -
Help in loading the xml file using AS 2.0
Hi
I try to load the Xml file in As file but i need do all the
fetching details from the __LoadXmlFile file function
but it's working fine can any one help me for this issue
~~SkYou can't! Well, at least Flex cannot do this. All Flex can
do is send this data -- any data -- to the server and it's up to
you how you want to append this data to a file on the server.
You see, flex can't write to local files. If you looking for
client side file manipulation, take a look at Flex's desktop
brother call AIR!
ATTA -
How to load an XML file to oracle9i server?
I want to use XSU DBMS_XMLsave package to load an XML file to a relational table using PL/SQL from a distant server. Now, I don't know how to load that XML file to the distant server.
Somebody help me?I want to use XSU DBMS_XMLsave package to load an XML file to a relational table using PL/SQL from a distant server. Now, I don't know how to load that XML file to the distant server.
Somebody help me? -
How to call the XML file as PrivateResourcePath in JSP
Hi All,
I want to call the layer-config.xml values in JSP dropdown list. How to call the XML file as PrivateResourcePath in JSP... please advise me if any solution.
locaiton: dist/PORTAL-INF/layer-config.xml
<?xml version="1.0" encoding="utf-8" ?>
- <layer-config>
- <system>
<layer>Test</layer>
<internal>true</internal>
</system>
- <system>
<layer>Test1</layer>
<internal>false</internal>
</system>
- <system>
<layer>Test3</layer>
<internal>false</internal>
</system>
</layer-config>
Thanks in advance.Hi,
The below link may help you.
[Accessing image from dist/imgaes folder inside JSPDynpage Component;
Regards,
Suresh Bachimanchi -
How to call the XML file as Private
Hi All,
I want to call the layer-config.xml values in JSP dropdown list. How to call the XML file as PrivateResourcePath in JSP... please advise me if any solution.
locaiton: dist/PORTAL-INF/layer-config.xml
<?xml version="1.0" encoding="utf-8" ?>
- <layer-config>
- <system>
<layer>Test</layer>
<internal>true</internal>
</system>
- <system>
<layer>Test1</layer>
<internal>false</internal>
</system>
- <system>
<layer>Test3</layer>
<internal>false</internal>
</system>
</layer-config>
Thanks in advance.Hi,
The below link may help you.
[Accessing image from dist/imgaes folder inside JSPDynpage Component;
Regards,
Suresh Bachimanchi -
How to get the XML file if we are using the Product short name.
Hi,
Till now I have used Short name of the Concurrent Program for Code while creating a Data Definition. Now saw a seeded template which has given the Code by Product short name. If we have the concurrent program then it is easy to refer the fields by checking the XML file. In this case how to find the XML file or how to refer all the fields if we have given code with Product short name. I saw this for iReceivables(ARI). Anybody please help me.
Thanks.Hi Siva
Just to clarify, rather than the short name of the conc program there is a shipped data definition that just uses the product short name? What is the data def so I can check it.
Regards, Tim -
How to overwrite the xml file...
Hi,
can any one help me how to overwrite the xml file.....
~~SkFlash Player cannot write XML files at all. but using
php+flash we could do it . -
Hi,
I have one intro.swf from that am loading one interface.swf by using loader.In interface i am loading some of the swf and xml am getting the swf but the xml files are not loading.When i run from interface file it is loading fine. only when i load the intro file the xml files are not loading. can any one tell me what is the problem how to access the xml content.
This is the code am using in interface.swf to to get the xmlpath
MovieClip(root).param1 = xmlPath;
to access the xml content i have written the code
var xmlPath:String=MovieClip(stage.getChildAt(0)).param1;
I am using one moviclip in interface to load the other swf and xml. I am not using any moviclip in intro file to load the interface swf for that i am using only the loader.Where are the files located relative to each other? If the intro and interface are in different folders then the problem could be that you need to adjust the path the interface uses for targeting the files it loads.
-
How to load a XML file into the database
Hi,
I've always only loaded data into the database by using SQL-Loader and the data format was Excel or ASCII
Now I have to load a XML.
How can I do?
The company where I work has Oracle vers. 8i (don't laugh, please)
Thanks in advance!Hi,
Tough job especially if the XML data is complex. The have been some similar question in the forum:
Using SQL Loader to load an XML File -- use 1 field's data for many records
SQL Loader to upload XML file
Hope they help.
Regards,
Sujoy -
How to load a xml file from a package inside of a jar file
hi@all
my application has got a xml configuration file which is saved inside the package tree of the class that reads this file.
when i`m developing using eclipse the class can find that file, everything works fine. but when i create a jar file of my application to use it in another application it cannot find that file anymore.
can anyone tell me how to solve this problem, please?
thx a lot
dialschi all,
the xml file is in the jar file and
ClassLoader.getSystemResourceAsStream(..) solved my problem.
in fact i did nameOfClassInSamePackageAsXmlFile.class.getResourceAsStream("nameOfFile.xml");thank you all
greez
dialsc -
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.
Maybe you are looking for
-
Problem about logical database programming
Dear all, I have a logical database PRPS_R which contail PRPS and some additional fields. In my abap report, I call this logical database by "GET PRPS_R". Can I ask how to perform sorting to the logical database in ABAP report? Thanks Sunny
-
How to recover password from Database link in Oracle 10G
Hi guys, How can I get a user password from DBLink in Oracle 10G? From sys.link$ the column "PASSWORD" is empty and the crypted data comming from the new column "PASSWORDX" does not work by using "... identified by values..." Any idea? Thanks...
-
my ipod touch has froze does anyone know how to reset it?
-
Question About Adding .TGA
OK, I used particleIllusion to export a .TGA sequence of an explosion so that I had Alpha channel... The problem is, when I import it to flash, i can't control where it is imported to on the stage... I can't move it because it only moves each slide i
-
Hi, i m new to this memeber, i need a good documentation of SAP MM PLEASE email me at [email protected] thanks and regards rajkumar