Extract data from xml file to Oracle table
hello to all members of forum..i have this stored procedures:
create or replace
PROCEDURE INSERTXML2(
p_xml_in XMLType,
p_table IN VARCHAR2 ) AS
v_context DBMS_XMLStore.ctxType;
v_rows NUMBER;
BEGIN
insCtx := DBMS_XMLStore.newContext(p_table); -- get saved context
dbms_xmlstore.setRowTag(insCtx,'Row');
DBMS_XMLStore.clearUpdateColumnList(insCtx); -- clear the update settings
-- set the columns to be updated as a list of values
DBMS_XMLStore.setUpdateColumn(insCtx,'ORDERNUMBER');
DBMS_XMLStore.setUpdateColumn(insCtx,'PLANT');
DBMS_XMLStore.setUpdateColumn(insCtx,'MATERIAL');
DBMS_XMLStore.setUpdateColumn(insCtx,'LINENUMBER');
DBMS_XMLStore.setUpdatecolumn(insCtx,'NOMSPEED');
DBMS_XMLStore.setUpdatecolumn(insCtx,'STARTDATE');
DBMS_XMLStore.setUpdatecolumn(insCtx,'FINISHDATE');
DBMS_XMLStore.setUpdatecolumn(insCtx,'TARGETQTY');
DBMS_XMLStore.setUpdatecolumn(insCtx,'UNIT');
DBMS_XMLStore.setUpdatecolumn(insCtx,'SYSTEMSTATUS');
v_rows := DBMS_XMLStore.insertXML(insCtx, xmldocument);
-- Close the context
DBMS_XMLStore.closeContext(insCtx);
END;
that works well in little XML files but in XML files that are bigger the stored procedures to not work because string maximum length in Oracle is 4000..can anyone know a solution to pass over this problem?!?!
one more thing im working with Oracle SQL Developer and Sap Mii, the XML file is generated in Sap Mii and then i have to pass it in one step to database..my one step is this stored procedure
one more thing im working with Oracle SQL developer and SAP Mii
regards and thanks in advance
matinha
Edited by: user11098081 on 23/Abr/2009 7:11
You can use CLOB for big files.
http://saubbane.blogspot.com/2010/12/saving-xml-file-into-table-with-plsql.html
Similar Messages
-
Extract data from XML file to Oracle database
Dear All
Please let me know, how to extract data from XML file to Oracle database which includes texts & images.
Thanking You
Regards Lakmal MarasingheI would do it from the database, but then again, I am a database / PL/SQL guy.
IMHO the database will deliver you with more options. I don't know about "speed" between the two. -
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,
SankalpThanks 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 -
Storing data from XML files in Oracle DB
Hi!
I just started to work with XML and need to save data from XML files into Oracle database. I tried to run sample from Oracle web site. The code was following:
public class xmlwritedb
public static void main(String args[]) throws SQLException
String tabName = "EMP"; // Table into which to insert XML data
String fileName = "emp.xml"; // XML document filename
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
// Initialize a JDBC connection
Connection conn =
DriverManager.getConnection("jdbc:oracle:oci8:scott/tiger@");
// Insert XML data from file (filename) into
// database table (tabName)
OracleXMLSave save = new OracleXMLSave(conn, tabName);
URL url = save.createURL(fileName);
int rowCount = save.insertXML(url);
System.out.println(" successfully inserted "+rowCount+
" rows into "+ tabName);
conn.close();
But it does not work.
OracleXMLSave object does not see file name.
Please, help me solve this problem. Also,where is it possible to find any documentation on oracle.xml.* classes API.
Thank you.
Maya.
null<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!!! -
Upload data from excel file to Oracle table
Dear All,
I have to upload data from excel file to Oracle table without using third party tools and without converting into CSV file.
Could you tell me please how can i do this using PLSQl or SQL Loader.
Thnaks in Advance..Dear All,
I have to upload data from excel file to
Oracle table without using third party tools and
without converting into CSV file.
Could you tell me please how can i do this
using PLSQl or SQL Loader.
Thnaks in Advance..As billy mentioned using ODBC interface ,the same HS service which is a layer over using traditional ODBC to access non oracle database.Here is link you can hit and trial and come out here if you have any problem.
http://www.oracle-base.com/articles/9i/HSGenericConnectivity9i.php[pre]
Khurram -
Loading data from .csv file into Oracle Table
Hi,
I have a requirement where I need to populate data from .csv file into oracle table.
Is there any mechanism so that i can follow the same?
Any help will be fruitful.
Thanks and regardsYou can use Sql Loader or External tables for your requirement
Missed Karthick's post ...alredy there :)
Edited by: Rajneesh Kumar on Dec 4, 2008 10:54 AM -
How to load the data from .csv file to oracle table???
Hi,
I am using oracle 10g , plsql developer. Can anyone help me in how to load the data from .csv file to oracle table. The table is already created with the required columns. The .csv file is having about 10lakh records. Is it possible to load 10lakh records. can any one please tell me how to proceed.
Thanks in advance981145 wrote:
Can you tell more about sql * loader??? how to know that utility is available for me or not??? I am using oracle 10g database and plsql developer???SQL*Loader is part of the Oracle client. If you have a developer installation you should normally have it on your client.
the command is
sqlldrType it and see if you have it installed.
Have a look also at the FAQ link posted by Marwin.
There are plenty of examples also on the web.
Regards.
Al -
How to extract data from XML file with JavaScript
HI All
I am new to this group.
Can anybody help me regarding XML.
I want to know How to extract data from XML file with JavaScript.
And also how to use API for XML
regards
NagarajuThis is a Java forum.
JavaScript is something entirely different than Java, even though the names are similar.
Try another website with forums about JavaScript.
For example here: http://www.webdeveloper.com/forum/forumdisplay.php?s=&forumid=3 -
Hi, extract data from xml file and insert into another exiting xml file
i am searching code to extract data from xml file and insert into another exiting xml file by a java program. I understood it is easy to extract data from a xml file, and how ever without creating another xml file. We want to insert the extracted data into another exiting xml file. Suggestions?
1st xml file which has two lines(text1.xml)
<?xml version="1.0" encoding="iso-8859-1"?>
<xs:PrintDataRequest xmlns:xs="http://com.unisys.com/Anid"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://com.unisys.com/Anid file:ANIDWS.xsd">
<xs:Person>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://com.unisys.com/Anid file:ANIDWS.xsd">
These two lines has to be inserted in the existing another xml(text 2.xml) file(at line 3 and 4)
Regards,
bubblyJadz_Core wrote:
RandomAccessFile? If you know where you want to insert it.Are you sure about this? If using this, the receiving file would have to have bytes inserted that exactly match the number of bytes replaced. I'm thinking that you'll likely have to stream through the second XML with a SAX parser and copy information (or insert new information) as you stream with an XML writer of some sort. -
Extract data from xml file and insert into another exiting xml fil
hello,
i am searching extract data from xml file and insert into another exiting xml file by a java program. I understood it is easy to extract data from a xml file, and how ever without creating another xml file. We want to insert the extracted data into another exiting xml file. Suggestions?
Regards,
ZhuozhiIf the files are small, you can load the target file in a DOM document, insert the data from the source file and persist the DOM.
If the files are large, you probably want to use a StAX or SAX. -
How to extract data from xml file and store that data inti data base table
Hii All
I have one table that table contains one column that column contain an XML file
I want to extract data from that XML file and want to store that extracted data into an other table.
That xml file has different different values
I want to store that values into table in diff diff columnsHi,
I am also facing the same problem.I have a .xml file and i need to import the data into the custom table in oracle database.
Can you please let me know if you know the solution how to do it in oracle apps.
Thanks, -
Load data from xml file in oracle data base
Hi all,
I'd like to know if is posible to load data from a file xml into a table of oracle data base through SQL*LOADER, loaded only in a normal column no with type XMLType , for example
I have a xml file
<person name="kate" surname="fari" city="new york" >
<son name="faus" age="18"/>
<son name="doly" age="10"/>
</person>
and I load in table :
table :person
column
name surname city
kate fari new york
table : son
name age
doly 10
faus 18
thank you for your return !!!!!!!!!
Ninova
Edited by: user10474037 on 30 mai 2011 08:47
Edited by: user10474037 on 30 mai 2011 08:48
Edited by: user10474037 on 30 mai 2011 08:48
Edited by: user10474037 on 30 mai 2011 08:49
Edited by: user10474037 on 30 mai 2011 08:50Hi
This May be found at
SQL Loader to upload XML file -
How to extract data from text file to database table
Hi ,
I am trying to upload data in text file to database table using GUI_UPLOAD function .what would be the program for that.
thanks in advance.Hi,
I don't think you have a standard sap program to upload data from file to database table...
Instead you can create a custom program like this..
DATA: T_FILEDATA(1000) OCCURS 0 WITH HEADER LINE.
DATA: T_ZTABLE LIKE ZTABLE OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:\TEST.TXT'
tables
data_tab = T_FILEDATA
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT T_FILEDATA.
T_ZTABLE = T_FILEDATA.
APPEND T_ZTABLE.
ENDLOOP.
MODIFY ZTABLE FROM TABLE T_ZTABLE.
COMMIT WORK..
Thanks,
Naren -
Extract data from xml column to other table
Hi
I have a table with clob column, inside have a xml, How can I to extract data inside column
Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
PL/SQL Release 9.2.0.8.0 - Production
CORE 9.2.0.8.0 Production
TNS for IBM/AIX RISC System/6000: Version 9.2.0.8.0 - Production
NLSRTL Version 9.2.0.8.0 - Productionthank you
I have a table
SQL> desc xml_documents;
Name Type Nullable Default Comments
DOCNAME VARCHAR2(200)
XMLDOC CLOB Y
TIMESTAMP DATE Y inside XMLDOC column there is only a record below
<!-- claim77804.xml -->
<Claim>
<ClaimId>77804</ClaimId>
<Policy>12345</Policy>
<Settlements>
<Payment Approver="JCOX">1000</Payment>
<Payment Approver="PSMITH">1850</Payment>
</Settlements>
<DamageReport>
The insured's <Vehicle Make="Volks">Beetle</Vehicle>
broke through the guard rail and plummeted into a ravine.
The cause was determined to be <Cause>faulty brakes</Cause>.
Amazingly there were no casualties.
</DamageReport>
</Claim>I tried to use example from : http://www.oracle-base.com/articles/9i/xmlsequence.php
SELECT extract(value(d), '//POLICY/text()').getStringVal() AS empno
FROM xml_documents x,
table(xmlsequence(extract(x.xmldoc, '/ROWSET/Claim'))) d;But no work, show me error
ORA-00932: inconsistent datatypes: expected - got - -
Extract Data from XML and Load into table using SQL*Loader
Hi All,
We have a XML file (sample.xml) which contains credit card transaction information. We have a standard SQL*Loader control file which loads the data from a flat file and the control file code is written as position based method. Our requirement is to use this control file as per our requirement(i.e) load the data into the table from our XML file), But we need help in converting the XML to a flat file or Extract the data from the XML tags and pass the information to the control file and in turn it loads the table.
Your suggestion is highly appreciated.
Thanks in advanceHi,
First of all go to PSA maintanance ( Where you will see PSA records ).
Goto list---> Save-> File---> Spreadsheet (Choose Radio Button)
> Give the proper file name where you want to download and then-----> Generate.
You will get ur PSA data in Excel Format.
Thanks
Mayank
Maybe you are looking for
-
Error Message access denied when trying to install on SD Card
Hi, I got this errormessage whan I'm trying to install the image about CMD (run as Admin): C:\FFUTEST>dism.exe /Apply-Image /ImageFile:flash.ffu /ApplyDrive:\\.\PhysicalDr ive1 /SkipPlatformCheck Access is denied. Does anybody know a solution
-
Why can't I access my apps on my phone from my computer?
Microsoft Windows 7 x64 Home Premium Edition Service Pack 1 (Build 7601) Hewlett-Packard HP ProBook 4440s iTunes 11.1.2.31 QuickTime 7.7.4 FairPlay 2.5.16 Apple Application Support 2.3.6 iPod Updater Library 11.1f5 CD Driver 2.2.3.0 CD Driver DLL 2.1
-
7 - Zip the system cannot find the file specified
after extracting i get this message - 7-Zip the system cannot find the file specified
-
HT201210 Error when trying to update my ipad
I got an error when trying to update my ipad saying it could not be updated and gave an error 6. Has anyone else had this happen and how did you rectify it?
-
ITunes not recognising iPhone or iPad since upgrading to OS 10.8.2 and iOS 6
Just upgraded to OS 10.8.2, and iOS 6 on iPhone and iPad. Now both these devises are not recognised in iTunes ( no Devices listed ). I have followed the suggested options with no success. Anyone else had this problem?