inserting XML data in a table
HelloI have a procedure that takes xmltype as input parameter that contains data such as:
<? XML version = "1.0"? >
rowset <>
< ROW >
< > 7782 EMPNO < / EMPNO >
CLARK < ENAME > < / ENAME >
MANAGER < JOB > < / JOB >
< MGR > 7839 < / MGR >
< HIREDATE > 9 June 81 < / HIREDATE >
< SAL > 2450 < / SAL >
< DEPTNO > 10 < / DEPTNO >
< / ROW >
< ROW >
< > 7839 EMPNO < / EMPNO >
KING of < ENAME > < / ENAME >
PRESIDENT < JOB > < / JOB >
< HIREDATE > 17 November 81 < / HIREDATE >
< SAL > 5000 < / SAL >
< DEPTNO > 10 < / DEPTNO >
< / ROW >
< ROW >
< > 7934 EMPNO < / EMPNO >
MILLER < ENAME > < / ENAME >
CLERK of < JOB > < / JOB >
< MGR > 7782 < / MGR >
< HIREDATE > 23 January 82 < / HIREDATE >
< SAL > 1300 < / SAL >
< DEPTNO > 10 < / DEPTNO >
< / ROW >
< / LINES >
I analyze this data and insert into the employee table.
I remember that using the extract function we can do, but I do not get it exactly.
Can you please help me in this.
Thank you
Vinod
See [url http://docs.oracle.com/cd/E14072_01/server.112/e10592/functions251.htm#CIHGGHFB] XMLTABLE
For example:
-- INSERT INTO
WITH x AS
(SELECT XMLTYPE('
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
') myxml
FROM DUAL)
SELECT *
FROM x
, XMLTABLE('/ROWSET/ROW'
PASSING x.myxml
COLUMNS empno, ename, job, mgr, hiredate, sal, deptno);
Tags: Database
Similar Questions
-
Insert XML data from the Table->; 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
SigcleYou 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
NikhilI 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.
-
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
======
My DB TableSQL> 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
Published by: RUSSO April 7, 2011 04:19Create table rgh_xml_storage ( user_id varchar2(4000), to_type varchar2(4000), mail_id varchar2(4000), subject varchar2(4000), sentDateTime varchar2(4000) )
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
-
I'm trying to insert xml data into the table with the oracle sql developer - sql + it works correctly, but it is very difficult to work with her. How ro resolve this problem?
Create table credit of XMLType;
I received the error report:INSERT INTO credit VALUES (xmltype( ' <?xml version="1.0"?> <creditid>a7565</creditid>' ));
SQL error: ORA-31011: failed to parse XML
ORA-19202: an error has occurred in the processing of XML
LPX-00209: PI names beginning with XML are reserved
Error on line 1
ORA-06512: at "SYS." XMLTYPE", line 310
ORA-06512: at line 1
31011 00000 - "XML parsing failed"
* Cause: XML parser returned an error trying to parse the document.
* Action: Check whether the document to parse is valid.
Thank you.
Published by: user11974179 on 2012.5.1 14:15And in case you do not have access to MOS, just remove the space to the left of the XML string:
INSERT INTO credit VALUES( xmltype('
a7565 ') ); -
How to insert CLOB data in tha table in my database
I create a table called (annual NUMBER, name VARCHAR and CLOB doc) html page
IsqlPlus I have run the following procedure
P4_FIRE_HTML_TRIGGER_ARG EXEC ("OLBA + LEGAL + PSOA + OEJN", file); file: came the CLOB parameterthe result parameter is set to the queue:
< ! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 / / IN" "http://..." >
< HTML >
< HEAD >
< TITLE > ADDS - METARS results form < / TITLE >
"< LINK REL ="StyleSheet"type =" text/css"HREF="/layout/awc/mystyle.css ">
< / HEAD >
< BODY BGCOLOR = "#FFFFFF" >
< TABLE SUMMARY = "this table is used for formatting only" BORDER = 0 CELLPADDING = 3 CELLSPACING = 0 >
< TR VALIGN = "top" >
< TD ALIGN = "left" COLSPAN = "2" >
< H2 > Aviation digital data Service (ADDS) < / H2 >
Produced by form of METAR (1858 & #160;) 11 February 2014 UTC) < BR >
" located at < A HREF =" http://AV .............................
< Table >
< /TR >
< TR VALIGN = "top" >
< TD ALIGN = "left" COLSPAN = "2" >
< FONT FACE = "Monospace, Courier" > OLBA 111800Z 01006KT 7000 FEW026 16/11 Q1022 < / POLICE > < BR >
< FONT FACE = "Monospace, Courier" > LEGAL 111830Z 34005KT 8000 NSC 13/11 Q1021 NOSIG < / POLICE > < BR >
< FONT FACE = "Monospace, Courier" > PSOA 111830Z 21009KT 9999 - RA BKN016 06/03 Q1003 NOSIG < / POLICE > < BR >
< FONT FACE = "Monospace, Courier" > OEJN 111800Z 34004KT CAVOK 25/20 Q1012 NOSIG < / POLICE > < BR >
< Table >
< /TR >
< /table >
< / BODY >
< / HTML >I try inserting the above result in my HtmlPage of the table by a simple insert:
Values inserted INTO HTMLPAGE (annual, doc)
(5, 'meatr_taf', ' <!) DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 / / IN" "http://... "
... < / HTML > ') values are not inserted just I got a message:
SP2-0863: iSQL * more treatmentCan someone help me to insert CLOB data in my table HtmlPage above
Thank yousoftware:
Form [32 bit] Version 9.0.2.9.0 (Production), oracle JInitiator: Version
1.3.1.9, WebUtil Version 1.0.2 (Beta), window xp service pack 2 build 2600, Internet Explorer 8
LOOP
UTL_HTTP. READ_LINE (RESP, File_Metar, TRUE);
p2_putlines (File_Metar);
USING_CLOB. ADD_MORE (1, File_Metar);
USING_CLOB. LOB_INS (1, 'Metar_taf', File_Metar);
END LOOP;
UTL_HTTP. END_RESPONSE (resp);You should not use USING_CLOB. LOB_INS (1, 'Metar_taf', File_Metar) inside the Loop.You must use
LOOP
UTL_HTTP. READ_LINE (RESP, File_Metar, TRUE);
p2_putlines (File_Metar);
USING_CLOB. ADD_MORE (1, File_Metar);
END LOOP;
-
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 # 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; -
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 youWith
SQL> select * from xmltable('root/row' passing xmltype('
steve 30 Paul 26 You can now just make a
Insert into emp as select...
-
My select statement fails with the error:
The ORA-19011 string buffer too small
The select statement looks like:
SELECT TO_CLOB)
XMLELEMENT ("accounts",
XMLELEMENT ("count",
XMLATTRIBUTES)
rownum AS "recordId."
To_date('20130520','YYYYMMDD') AS "datestarted."
123456 AS "previousBatchId."
56789 AS 'previousRecordId '.
),
....
.... .
.....
XMLFOREST)
SIG_ROLE AS "SignatoryRole."
To_char(TRANSFER_DATE,'YYYY-mm-DD') AS "TransferDate."
NVL(Reason,0) AS 'reason '.
) AS the 'transfer '.
)
()) AS CRDTRPT
OF ANY_TABLE;
- It looks like I can choose only 4000 characters using the SELECT statement (please, correct me if I'm wrong)
I'd use the XMLGEN package. But the environment team says no mounted drives in the future with the arrival of the EXADATA.
NO HARD DRIVE MOUNTED, NO ACCESS TO THE DATABASE DIRECTORIES
No UTL_FILE
I need to use the REEL spool the resulting XML data of the SELECT query.
SQL is a standard in my org, but I can do with a PL/SQL solution also to load data into a table (cannot use a COIL with PL/SQL)
What I do is:
- a column of type CLOB to a xml_report of the loading of the above SELECT query table
- Then using SELECT * FROM xml_report to SPOOL the data to a file report.xml
No need of XMLTYPE data behind. Xml data stream is fine for me.
In addition, I need to validate the XML file, also using XSD.
Problem is that the resulting lines of the select query are supposed to be from 15000 to 20000 bytes long.
Oracle database version: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
A Suggestion or a solution to this problem would be appreciated.
(Sorry for the use of "BOLD", just to make it more readable and highlight the imp points)
Bravo!
Rahul
It looks like I can choose only 4000 characters using the SELECT statement (please, correct me if I'm wrong)
You use the right method.
There is an implicit conversion from XMLType to the data type VARCHAR2 as expected by the function TO_CLOB, where the limitation, and the error.
To serialize XMLType to CLOB, use the XMLSerialize function:
SELECT XMLSerialize (DOCUMENT
XMLELEMENT ("accounts",
...
)
)
OF ANY_TABLE;
For the rest of the requirement, I wish you good luck trying to spool the XML correctly.
You may need to play around with the SET LONG and SET LONGCHUNKSIZE commands to operate.
-
How to insert the data from the table file?
I need to know that how can I insert data into multiple columns by file. I can simply insert data into a table of columns, but could not find a way to put the data in the column all.
My data in a file store
************************************************text.txt***************
133, nanny, nagina, 14 mph, 45637, 9156729863
**************************************************************my_data(table)**********
try to insert into table below...
Name, ID, last_name, add, PIN. Mob
*********************************************
Let me know if you need anything else... :))Hey nanny.
In fact, in SQL Developer, you can open a connection to the target schema, right-click on the Tables node in the Navigator tree, select import the data, then use the data import wizard. It is extremely flexible. Looks like you have a file of comma-separated variables, so if you select Format: csv and import method: Insert it will probably work fine.
To minimize the risk of errors during import, choose a limit value of preview so that the wizard can review the data type and the size of all columns in several lines of data as possible, and then examine the size/type of data for each column on the next page of the wizard and replace if necessary. For date columns, it is also important to choose the appropriate format mask.
Hope this helps,
Gary
SQL development team -
Loading XML data in the tables
Hi, I am currently working on a calendar of upcoming events. I have everything works fine, including the loading of an xml database based on the month and year in the temporary within the XML onLoad section tables, but my problem is obtaining data in a table that I can look in my DrawDays() function. Right now I'm pushing the content of the temporary table in loadXMLevent() in _root. Calendar.event_text_array and this table is filled up until I get into the DrawDays function. Any help would be greatly appreciated. I deleted the code associated with this email.
Thank you!
Chris
You cannot call DrawDays() until loadEventArray() execution.
-
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
AlfieNevermind, I finally managed to do work!
-
Hello
I have a requirement to write a stored procedure that will be an XML file as an input argument and the search for the tags < salary / >, < Manager / > in the XML file and insert those values in a table.
The pointers will be appreciated.
ConcerningTwo options are to analyze this in PL/SQL and pass these results in INSERT statements or spending it all in an INSERT
SELECT... OF... article and let the DB do all the work for you. Without knowing more details, an example of how to do analysis in PL/SQL as an XMLType can be seen in the second method in {: identifier of the thread = 926354}. You would need another loop internal to analyze all OrderDetail nodes because they can repeat for each node in the client.
If the structure of the table that you ever go in allows it, you can use this as the SELECT part of your INSERT statement
SQL> SELECT customerid, orderid, productid 2 FROM XMLTABLE('/ROOT/Customer' 3 PASSING XMLTYPE('
4 ') -- this would just be a variable instead of hard-coded XML 16 COLUMNS 17 customerid VARCHAR2(20) PATH '@CustomerID', 18 orderdetails XMLTYPE PATH 'Order/OrderDetail') ta, 19 XMLTABLE('/OrderDetail' 20 PASSING ta.orderdetails 21 COLUMNS 22 orderid VARCHAR2(20) PATH '@OrderID', 23 productid VARCHAR2(20) PATH '@ProductID') tb; CUSTOMERID ORDERID PRODUCTID -------------------- -------------------- -------------------- VINET 10248 11 VINET 10248 42 LILAS 10283 725 106 97 8 11 1512 1413 -
How insert/DML data in the table when the data in the related table changes
Hello guys!
I came across a problem that I need to get fixed. Because I don't know how to start and get it resolved I wanted to ask you for your expertise.
The scenario is as follows:
I have a table 'a' in my 10g database and a view "ab" which combined table 'a' with 'b' table in a view. However, the 'b' table is a table in another schema Manager database. and accessible (read only right) via a database link.
Now here it is: whenever the data changes in table "b", for example 2 new sets of data is inserted, I need to insert automatically the 2 values of these 2 sets of data in my table "a". Same procedure for update and delete in table "b".
The action that inserts data into the table 'a' must be initialized in my database, I have limited access to the other. Can I somehow use a trigger my reviews of "ab" to insert data into the table "a"? Or is it possible to use the "change notification procedure database" using the view as the reference?
Desperately need help and example of all suspicion/code greatly appreciated. I am very new to Oracle and not very fond of PL/SQL routines. So please be so kind as to give me more details.
Thanks in advance - I hope you have any ideas how I can get this problem resolved.
Sebastian>
... it does not, since the DDL operations are not permitted on the remote databases (ORA-02021). I can't create the trigger on a view either. :-(
So what ways are left to insert data into the table 'a' when the related table changes?Please, help if you have an idea!
Yes,
You can't perform the DDL (create the trigger...) on remote databases as you can see...
Try to create this trigger in the local database that will make DML (insert into...) on the remote database.CREATE OR REPLACE TRIGGER local_forward_pt_after_insert AFTER INSERT ON N2K_INV_PT FOR EACH ROW BEGIN -- Insert records into table "a" INSERT INTO TBL_PUNKTDATEN@remote_database_sid ( INT_NUMMER, STR_GEBIET ) VALUES ( :new.INT_INV_PT_NR, :new.GEBIET ); END;
Thank you
Good luck
-
XML data in the table using sql/plsql
Hi experts,
Could you please help with the following requirement. I have the tags xml (.xml on a server file) below. I need to access this file and read the XML and insert into the db table using sql and plsql. Is it possible with the cdata below? And there is a nested this table.
Could someone please guide me if you have a sample code file and xml.
<? XML version = "1.0" encoding = "UTF-8"? >
< generation_date > <! [CDATA [17/11/2015]] > < / generation_date >
< generated_by > <! [CDATA [Admin Admin]] > < / generated_by >
< year > <! [CDATA [2015]] > < / year >
< month > <! [CDATA [01]] > < / month >
< author >
< author > <! [CDATA [user author]] > < / author > < author_initial > <! [CDATA [user]] > < / author_firstname > < author_country > <! [CDATA [author]] > < / author_lastname >
< author_email > <! [CDATA [[email protected]]] > < / author_email >
< author_data_01 > <! [CDATA []] > < / author_data_01 >
< author_data_02 > <! [CDATA []] > < / author_data_02 >
< items >
< article_item >
< article_id > <! [CDATA [123456]] > < / article_id >
< publication > <! [CDATA [Al Bayan]] > < / publication >
< section > <! [CDATA [Local]] > < / section >
< issue_date > <! [CDATA [11/11/2015]] > < / issue_date >
< page > <! [CDATA [2]] > < / print this page >
< article_title > <! [CDATA [title.]] > < / article_title > < number_of_words > <! [CDATA [165]] > < / number_of_words >
< original_price > <! [CDATA [200]] > < / original_price >
< original_price_currency > <! [CDATA [DEA]] > < / original_price_currency >
< price > <! [CDATA [250]] > < / price >
< price_currency > <! [CDATA [DEA]] > < / price_currency >
< / article_item >
< / articles >
< total_amount > <! [CDATA [250]] > < / total_amount >
< total_amount_currency > <! [CDATA [DEA]] > < / total_amount_currency >
< / author >
< / xml >
Thanks in advance,
Suman
XMLTABLE using...
SQL > ed
A written file afiedt.buf1 with t (xml) as (select xmltype ('))
2 ") of the double)"
3
4
5
6
7
8
9
10
11
[[12[email protected]]] >
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34-
35 end of sample data
36-
37 - assumptions:
(38 - a) XML may have several tags
(39 - b) eachmay contain more
40-
41 select x.gen_by, x.gen_date, x.mn, x.yr
42, y.author, y.auth_fn, y.auth_ln, y.auth_cnt, y.auth_em, y.auth_d1, y.auth_d2
43, z.id, z.pub, z.sec, z.iss_dt, z.pg, z.art_ttl, z.num_wrds, z.oprice, z.ocurr, z.price, z.curr
44 t
45, xmltable ('/ authxml')
from $ 46 t.xml
path of 47 columns gen_date varchar2 (10) '. / generation_date'
48, path of varchar2 (15) of gen_by '. / generated_by'
49, path of varchar2 (4) year '. "/ year"
50 varchar2 (2) mn road '. "/ month"
51, path of xmltype authors '.'
52 ) x
53, xmltable ('/ authxml/authors ')
from $ 54 x.authors
author of 55 path of varchar2 columns (15) '. / author'
56, path of varchar2 (10) of auth_fn '. / author_firstname'
57, path of varchar2 (10) of auth_ln '. / author_lastname'
58 road of VARCHAR2 (3) auth_cnt '. / author_country'
59 road of varchar2 (20) of auth_em '. / author_email'
60 road of varchar2 (5) of auth_d1 '. / author_data_01'
61, path of varchar2 (5) of auth_d2 '. / author_data_02'
62, path of xmltype articles '. / Articles'
63 ) y
64, xmltable ('/ Articles/article_item ')
from $ 65 y.articles
path id 66 number columns '. / article_id'
67, path of varchar2 (10) pub '. ' / publication.
68 road of varchar2 (10) dry '. / section'
69, path of varchar2 (10) of iss_dt '. / issue_date'
70 road of VARCHAR2 (3) pg '. "/ print this page"
71, path of varchar2 (20) of art_ttl '. / article_title'
72, path of varchar2 (5) of num_wrds '. / number_of_words'
73, path of varchar2 (5) of oprice '. / original_price'
74 road to VARCHAR2 (3) ocurr '. / original_price_currency'
75, path of varchar2 (5) price '. "/ price"
76, path of VARCHAR2 (3) curr '. / price_currency'
77* ) z
SQL > /.GEN_DATE GEN_BY YEAR MN AUTHOR AUTH_FN AUTH_LN AUT AUTH_EM AUTH_ AUTH_ ID PUB DRY ISS_DT PG ART_TTL NUM_W OPRIC HEARTS PRICE OCU
---------- --------------- ---- -- --------------- ---------- ---------- --- -------------------- ----- ----- ---------- ---------- ---------- ---------- --- -------------------- ----- ----- --- ----- ---
17/11/2015 Admin Admin 2015 01 user author user author [email protected] 123456 UAE Al Bayan Local 11/11/2015 2 is the title. 165 200 AED AED 250Of course, you'll want to change the types of data, etc. as needed.
I assumed that the XML can contain several "
" sections and that each section can contain several entries. Thus the XMLTABLE aliasing as 'x' gives information of XML, and supplies the data associated with the XMLTABLE with alias 'y' which gets the multiple authors, which itself
section of the XMLTABLE with alias 'z' for each of the article_item. CDATA stuff are handled automatically by SQLX (XML functionality integrated into Oracle's SQL)
Maybe you are looking for
-
A slow Internet connection is in Satellite A100-233
Computer laptop A100-233 is slower download speeds of about 2-4 KB / s, although my server is too slow. The problem is that the same coffee, the same files at the same time pass at a speed of about 8-10 kbit/s. It is with internet explore 6 and 7 and
-
Want all-in-one printer well under warranty (bought end of August 2014) 120. Problem: sudden lack of scanner. I got in touch with Scott of the Canada-USA on 17 November 2014, 22:08 (Italian time). He gave me all the instructions of thHP printing & sc
-
an email to send to someone else came in my mailbox
A few days ago I received an email from someone I don't know. When I check the details I realized that this message was intended to be sent to a different email address. So my email address is * address email is removed from the privacy *, sent this
-
I can't open regional and language option
Hi, I can't open regional and language option and and when I turn on any program I have to press fn and ctrl 4 times to set lathin letters, what can I do?
-
What is the difference between 32 and 64 bit