XML DB to Relational table?
Hi Everybody,
We have a situation to map the elements/attributes of XML tables in XML DB (Oracle 9i) to target relational tables.
We have XML schema as starting point. Do you have any white paper or documentation to help us do mapping ?
I appreciate your help.
Ram
You can start from here:
http://otn.oracle.com/tech/xml/xmldb/index.html
Similar Messages
-
Mapping with xml-schema XML-data to relational tables
Hello,
is it possible to map data from xml documents to relational tables with xml-schema?
I mean not in nested tables but in relational tables with primary and foreign keys!
With SQL Server 2005 it is very easy, I dont believe that Oracle couldn't do this!
I searched but i cant find anything about that!
Thx
user445232indeed, oracle does this for xml schema based xmltype data, however, these underlying tables are not accessable to the application. Maybe It should for next version, so folks who like to use relational model can use it without mapping it manually.
Actually, nested tables, are the same, their underlying tables (segments) are indeed relational tables, oracle manages them internally and not visiable to the application. You can find them in the user_segments, user_objects views though. -
Generate xml from non-relational table
Hi
I would like to create hierarchical xml from non-relational table as below, can anybody share some idea?
I have tried the XMLAgg/XmlElement and could not get the desired result. Any help would be greately appreciated.
create table testing
( super_cat varchar2(30)
, normal_cat varchar2(30)
, sub_cat varchar2(30)
, detail varchar2(30));
CREATE UNIQUE INDEX IDX_TESTING ON TESTING(SUPER_CAT,NORMAL_CAT,SUB_CAT);
insert into testing values ('SUPER_A','NORMAL_A','SUB_A', 'DETAIL1');
insert into testing values ('SUPER_A','NORMAL_A','SUB_B', 'DETAIL2');
insert into testing values ('SUPER_A','NORMAL_B','SUB_A', 'DETAIL3');
insert into testing values ('SUPER_A','NORMAL_B','SUB_B', 'DETAIL4');
COMMIT;The result should be like :
<Document>
<SuperCategory>
<SuperCategoryName>SUPER_A</SuperCategoryName>
<NormalCategory>
<NormalCategoryName>NORMAL_A</NormalCategoryName>
<SubCategory>
<SubCategoryName>SUB_A</SubCategoryName>
<ResultDetail><Detail>DETAIL1</Detail></ResultDetail>
</SubCategory>
<SubCategory>
<SubCategoryName>SUB_B</SubCategoryName>
<ResultDetail><Detail>DETAIL2</Detail></ResultDetail>
</SubCategory>
</NormalCategory>
<NormalCategory>
<NormalCategoryName>NORMAL_B</NormalCategoryName>
<SubCategory>
<SubCategoryName>SUB_A</SubCategoryName>
<ResultDetail><Detail>DETAIL3</Detail></ResultDetail>
</SubCategory>
<SubCategory>
<SubCategoryName>SUB_B</SubCategoryName>
<ResultDetail><Detail>DETAIL4</Detail></ResultDetail>
</SubCategory>
</NormalCategory>
</SuperCategory>
</Document>user563940 wrote:
Hi
I would like to create hierarchical xml from non-relational table as below, can anybody share some idea?
I have tried the XMLAgg/XmlElement and could not get the desired result. Any help would be greately appreciated.I think you should be able to achieve this with the addition of XMLFOREST.
http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/functions244.htm#SQLRF06169 -
How to create xml file from relational tables in 10gR2
Hi,
I am very new to XML and was wondering how to create an XML file from querying relational tables. Some child tables may contain multiple rows that need to be returned in certain instances. Other queries will just be single or multiple rows from one or more tables. I would like to use the latest feathers in 10gR2. Thanks for any help you can provide.
Thanks,
LeeHere is the first row of data created from our person table - it used the column names as the tag names:
<?xml version="1.0"?>
<ROWSET>
<ROW>
<MP_ID_SEQ>289</MP_ID_SEQ>
<MP_NAME>LOBERG,JUDITH LEE</MP_NAME>
<MP_SEX>F</MP_SEX>
<MP_RACE>I</MP_RACE>
<MP_DOB>19500709</MP_DOB>
<MP_HT>504</MP_HT>
<MP_WT>170</MP_WT>
<MP_EYE_CLR>BLU</MP_EYE_CLR>
<MP_HAIR_CLR>BRO</MP_HAIR_CLR>
<MP_SKN>RUD</MP_SKN>
<MP_SMT>POCKMARKS</MP_SMT>
<MP_SOC>517607968</MP_SOC>
<MP_OLN>517607968</MP_OLN>
<MP_OLS>MT</MP_OLS>
<MP_OLY>2007</MP_OLY>
<MP_CAUT_MED>70</MP_CAUT_MED>
<MP_VISION_SCRIPT>C0RRECTIVE LENSES</MP_VISION_SCRIPT>
<MP_DNA_AVAIL>N</MP_DNA_AVAIL>
<CREATED_BY>MMPS</CREATED_BY>
<DTM_CREATED>31-AUG-06</DTM_CREATED>
<MI_INC_ID_SEQ>288</MI_INC_ID_SEQ>
<MP_ALERT>N</MP_ALERT>
</ROW> -
Loading XML Data into Relational Table
Hello,
I receive an XML file generated from another tool (on Windows), I am trying to create a Linux shell script that will gather the needed XML file from my Linux database server, then have Oracle use this file to load the XML data into a relational table. This activity & data will be needed on an ongoing basis.
I have tried this two ways. First, I loaded the XML document into the database and tried to extract the data directly from the document, but that is not working. Now I want to try to read the data directly from the file on the server via select, however I am not getting any data returned. In the Select statement below, I am simply trying to query the data to see what is returned for my testing.
Create Table ci_results_table (transactionID Varchar2(100), //transactionID should be PrimaryKey but was getting NULL value errors during insert test, so removed PK
message Varchar2(200),
ci Varchar2(50),
processeddate xmltype,
status Varchar2(50),
sourcefile VarChar2(100));
select x.*
from XMLTable(
'TSPLoadResults/Results'
PASSING xmltype(bfilename('CMDB_DEVADHOCRESULTS_DIR','LoadResults-HP_146.results.xml'), nls_charset_id('AL32UTF8'))
COLUMNS
transactionID Varchar2(100) PATH 'TransactionID',
Result XMLType PATH 'Result',
Message Varchar2(200) PATH 'Message',
PrimaryKey Varchar2(50) PATH 'PrimaryKey',
ProcessedDate date PATH 'ProcessedDate',
Status Varchar2(50) PATH 'Status',
SourceFile VarChar2(100) PATH 'SourceFileName'
) x
Eventually I will need to build on this to limit the data returned to those records where SourceFileName is like 'HPDS%' and insert what is returned in to the ci_results_table. Attached is a sample Results XML file I am trying to load, It is named "ResultsTransformedtoUnix" because I used dos2Unix to convert it to Unix which may be right or wrong. (The output file I send out has to be transformed to DOS format before the other application can read it). Original file (before Unix conversion) named in script is also attached.
Please help. Thank you!Hi,
I see some wrong things in your query.
1) The obvious one, explaining why you're not getting any data : there's a typo in the XQuery expression, it's "Result" not "Results"
2) ProcessedDate cannot be extracted as a date (at least not directly) since it actually represents a timestamp, use TIMESTAMP WITH TIME ZONE datatype and cast back to DATE in the SELECT clause
3) transactionID is an attribute, it must be accessed with '@' (or 'attribute::' axis)
4) If the file encoding is truly ISO-8859-1 as the prolog suggests, then do not use AL32UTF8 but the corresponding charset name : WE8ISO8859P1
Here's the working query :
select x.transactionID
, x.Message
, x.Primarykey
, cast(x.ProcessedDate as date) ProcessDate
, x.Status
, x.SourceFile
from XMLTable(
'/TSPLoadResults/Result'
PASSING xmltype(bfilename('XML_DIR','LoadResults-HP_146.results.xml'), nls_charset_id('WE8ISO8859P1'))
COLUMNS
transactionID Varchar2(100) PATH '@transactionID',
Message Varchar2(200) PATH 'Message',
PrimaryKey Varchar2(50) PATH 'PrimaryKey',
ProcessedDate timestamp with time zone PATH 'ProcessedDate',
Status Varchar2(50) PATH 'Status',
SourceFile VarChar2(100) PATH 'SourceFileName'
) x
Using this query directly over the file will only perform decently (for large files) on 11.2.0.4 and onwards.
On prior versions, first load the file in a (temporary) XMLType column with Binary XML storage and SELECT from there.
because I used dos2Unix to convert it to Unix which may be right or wrong.
This conversion shouldn't be necessary. -
XML Data from Relational Tables
Hi,
My requirement is to pull data from relational tables into xml format and port it to the user (either as a file or allow the user to access it directly from their browser). What is the best way to accomplish this. Your suggestions are appreciated.
thanks.Marco,
Thanks for your reply, did try that , but I want the users to query this view also. Due to the nature of the xml structure I am getting the correct results. May be my xpath query is not right? My xml is as below:
<node1 attribute-node1 = "somevalue1">
<cnode1 attribute-cnode1 = "somevalue2">
<cnode2 attribute-cnode2 = "somevalue3">
<cnode3>somevalue4</cnode3>
<cnode4>somevalue5</cnode4>
</cnode2>
<cnode2 attribute-cnode2 = "somevlaue6">
<cnode3>somevalue6</cnode3>
<cnode4>somevalue7</cnode4>
</cnode2>
</cnode1>
</node1>
and my requirement is like : the user wants to see only cnode2 with attribute value "somevalue3" (along with the rest of the xml) ie
<node1 attribute-node1 = "somevalue1">
<cnode1 attribute-cnode1 = "somevalue2">
<cnode2 attribute-cnode2 = "somevalue3">
<cnode3>somevalue4</cnode3>
<cnode4>somevalue5</cnode4>
</cnode2>
</cnode1>
</node1>
Need the correct xpath query for this.
Thanks -
Removing tags and joining xml to a relational table
db ver 11.2
New to do the whole XML thing so trying hard to figure it out.
I want to join from cdata value to a relational table
the XML is
<?xml version="1.0"?>
<ROWSET>
<ROW>
<RN>1</RN>
<EMP_ROW>
<EMP_ROW_ROW>
<FNAME>pete</FNAME>
<ADDRESS>x1 rd</ADDRESS>
</EMP_ROW_ROW>
<EMP_ROW_ROW>
<FNAME>pete</FNAME>
<ADDRESS>x1 rd</ADDRESS>
</EMP_ROW_ROW>
<EMP_ROW_ROW>
<FNAME>pete2</FNAME>
<ADDRESS>x2 rd</ADDRESS>
</EMP_ROW_ROW>
<EMP_ROW_ROW>
<FNAME>pete3</FNAME>
<ADDRESS>x4 rd</ADDRESS>
</EMP_ROW_ROW>
<EMP_ROW_ROW>
<FNAME>pete</FNAME>
</EMP_ROW_ROW>
<EMP_ROW_ROW>
<FNAME>pete3</FNAME>
<ADDRESS>x4 rd</ADDRESS>
</EMP_ROW_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>2</RN>
<EMP_ROW>
<EMP_ROW_ROW>
<FNAME>pete</FNAME>
</EMP_ROW_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>3</RN>
<EMP_ROW>
<EMP_ROW_ROW>
<FNAME>pete3</FNAME>
<ADDRESS>x4 rd</ADDRESS>
</EMP_ROW_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>4</RN>
<EMP_ROW>
<EMP_ROW_ROW>
<FNAME>pete4</FNAME>
<ADDRESS>a str</ADDRESS>
</EMP_ROW_ROW>
<EMP_ROW_ROW>
<FNAME>pete3</FNAME>
<ADDRESS>b str</ADDRESS>
</EMP_ROW_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>5</RN>
<EMP_ROW>
<EMP_ROW_ROW>
<FNAME>bob1</FNAME>
<ADDRESS>c str</ADDRESS>
</EMP_ROW_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>6</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>7</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>8</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>9</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>10</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>11</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>12</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>13</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>14</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>15</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>16</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>17</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>18</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>19</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>20</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
</ROWSET>the relational table is:
create table t(
rn number primary key
with 20 rows 1 to 20the results should be in a relational table
RN XML
1 <EMP_ROW>
<EMP_ROW_ROW>
<FNAME>pete</FNAME>
<ADDRESS>x1 rd</ADDRESS>
</EMP_ROW_ROW>
<EMP_ROW_ROW>
<FNAME>pete</FNAME>
<ADDRESS>x1 rd</ADDRESS>
</EMP_ROW_ROW>
<EMP_ROW_ROW>
<FNAME>pete2</FNAME>
<ADDRESS>x2 rd</ADDRESS>
</EMP_ROW_ROW>
<EMP_ROW_ROW>
<FNAME>pete3</FNAME>
<ADDRESS>x4 rd</ADDRESS>
</EMP_ROW_ROW>
<EMP_ROW_ROW>
<FNAME>pete</FNAME>
</EMP_ROW_ROW>
<EMP_ROW_ROW>
<FNAME>pete3</FNAME>
<ADDRESS>x4 rd</ADDRESS>
</EMP_ROW_ROW>
</EMP_ROW>
2 <EMP_ROW>
<EMP_ROW_ROW>
<FNAME>pete</FNAME>
</EMP_ROW_ROW>
</EMP_ROW>I am wanting to join on the <RN> to the RN in the relational table.
Been trying at this for a bit .. seems like xmltable and xquery should get me there but have problems.I guess since there are many and duplicate <RN> in the XML the function returns one row
<RN>1</RN><RN>2</RN><RN>3</RN><RN>4</RN><RN>5</RN><RN>6</RN><RN>7</RN><RN>8</RN><RN>9</RN><RN>10</RN><RN>11</RN><RN>12</RN><RN>13</RN><RN>14</RN><RN>15</RN><RN>16</RN><RN>17</RN><RN>18</RN><RN>19</RN><RN>20</RN> "<?xml version="1.0"?>
<ROWSET>
<ROW>
<RN>1</RN>
<EMP_ROW>
<EMP_ROW_ROW>
<FNAME>pete</FNAME>
<ADDRESS>x1 rd</ADDRESS>
</EMP_ROW_ROW>
<EMP_ROW_ROW>
<FNAME>pete</FNAME>
<ADDRESS>x1 rd</ADDRESS>
</EMP_ROW_ROW>
<EMP_ROW_ROW>
<FNAME>pete2</FNAME>
<ADDRESS>x2 rd</ADDRESS>
</EMP_ROW_ROW>
<EMP_ROW_ROW>
<FNAME>pete3</FNAME>
<ADDRESS>x4 rd</ADDRESS>
</EMP_ROW_ROW>
<EMP_ROW_ROW>
<FNAME>pete</FNAME>
</EMP_ROW_ROW>
<EMP_ROW_ROW>
<FNAME>pete3</FNAME>
<ADDRESS>x4 rd</ADDRESS>
</EMP_ROW_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>2</RN>
<EMP_ROW>
<EMP_ROW_ROW>
<FNAME>pete</FNAME>
</EMP_ROW_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>3</RN>
<EMP_ROW>
<EMP_ROW_ROW>
<FNAME>pete3</FNAME>
<ADDRESS>x4 rd</ADDRESS>
</EMP_ROW_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>4</RN>
<EMP_ROW>
<EMP_ROW_ROW>
<FNAME>pete4</FNAME>
<ADDRESS>a str</ADDRESS>
</EMP_ROW_ROW>
<EMP_ROW_ROW>
<FNAME>pete3</FNAME>
<ADDRESS>b str</ADDRESS>
</EMP_ROW_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>5</RN>
<EMP_ROW>
<EMP_ROW_ROW>
<FNAME>bob1</FNAME>
<ADDRESS>c str</ADDRESS>
</EMP_ROW_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>6</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>7</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>8</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>9</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>10</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>11</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>12</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>13</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>14</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>15</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>16</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>17</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>18</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>19</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
<ROW>
<RN>20</RN>
<EMP_ROW>
</EMP_ROW>
</ROW>
</ROWSET>
" -
Load XML Data into relational Table
Hi All,
I have a requirement to load data in an XML file into columns in an oracle table. This has to be done on the command line from a unix box which connects to a remote oracle DB.
Can some one give me a step by step procedure to do this (preferably using sqlloader) or point me in the right direction.
thank youHi,
Read "Oracle XML DB Developer's guide", Chapters 2,3,4,5.
That will give you very good idea.
The reason, I am suggesting reading is, there is not "one" way to do it. There can be many good ways, depending on the size, complexity of the XML and also your intended use of that XML data.
Regards -
Create a large XML extract from relational tables - 10g
The Oracle 10g documentation recommends using the various SQL functions such as XMLAGG,XMLELEMENT or DBMS_XMLGEN under chapter "16 Generating XML Data from the Database" for generating a XML extract file. The DBMS_XMLDOM seems like a useful structured package to create a XML formatted extract. Any idea why Oracle does not recommend the use of XMLDOM API ? Are there performance issues or likely de-support ?
Whats the best way to produce a large XML extract?
Thanks.mdrake wrote:
No reason not to use it. It just tends to require a lot more coding than the other methods. Underneath the covers they all map into the same code-line. In general, to generate a given XML document you wlll write far fewer lines of code using the SQL/XML operators. Less Code written = less code to maintan = faster time to market.Less code to parse...? -
XML file validation with XSD and loading to database relational table
Hi all,
I have some xml files coming to my unix directory. I will be having an XSD for those. My task is to validate those xml against given xsd and load the corresponding data into oracle relational tables with sqlloader only.
Please help me to accomplish. and let me know the contents of control file ( for SQLLOADER) if i want to load the xml directly to database.
Unix and/or PLSQL suggestions both are welcome.My problem area is loading the XML to Oracle relational tables using sqlloader.
suppose, the xml is <?xml version="1.0"?>
<Customers>
<Customer>
<CustID>1</CustID>
<Company>Bell South</Company>
<City>New York</City>
</Customer>
<Customer>
<CustID>2</CustID>
<Company>Barnes & Noble</Company>
<City>New York</City>
</Customer>
<Customer>
<CustID>3</CustID>
<Company>Comp USA</Company>
<City>Tampa</City>
</Customer>
<Customer>
<CustID>4</CustID>
<Company>Borders</Company>
<City>Charlotte</City>
</Customer>
</Customers>
and I have a relational table
CREATE TABLE CUSTOMERS
CUSTID NUMBER,
COMPANY VARCHAR2(100 BYTE),
CITY VARCHAR2(100 BYTE)
how to insert the xml data into the table???
please help..
Edited by: nuon on Oct 25, 2010 6:25 AM -
Nested XML output in relational format
I have serious performance issue in converting the relational xml in to relational table.
Below is my query which works good if number of nodes are around <100.
I have issue if number of node is more then 500.I have requirement where the number of nodes can be >5000.
I am using Oracle 11g R2.
Appreciate the help in tuning this or any alternative for this.
Thanks,
WITH t1
AS (SELECT xmltype('<Id_359328 prodId="101265" prodName="Computer">
<Id_359329 prodId="101788" prodName="C1">
<Id_359330 prodId="175" prodName="C2"/>
<Id_359331 prodId="101766" prodName="C3"/>
</Id_359329>
<Id_388909 prodId="100654" prodName="C4"/>
<Id_388191 prodId="100672" prodName="C5"/>
<Id_388927 prodId="100625" prodName="C6"/>
<Id_359332 prodId="101766" prodName="C7">
<Id_359380 prodId="100651" prodName="C8" />
<Id_359334 prodId="100643" prodName="C9">
<Id_359337 prodId="101788" prodName="C10">
<Id_359338 prodId="175" prodName="C11"/>
<Id_359339 prodId="101766" prodName="C12"/>
</Id_359337>
</Id_359334>
<Id_359336 prodId="101860" prodName="C13"/>
</Id_359332>
</Id_359328>')
t1_val
FROM DUAL)
SELECT ROWNUM rn, id, prod_id, prnt_id
FROM t1,
XMLTABLE ('for $i in $doc/descendant::*
return <ROW><Id>{name($i)}</Id>
<PROD_ID>{data($i/@prodId)}</PROD_ID>
<PRNT_ID>{name($i/..)}</PRNT_ID>
</ROW>'
PASSING t1.t1_val AS "doc"
COLUMNS id VARCHAR2 (100) PATH '/ROW/Id',
prod_id NUMBER PATH '/ROW/PROD_ID',
prnt_id VARCHAR2 (100) PATH '/ROW/PRNT_ID'
ORDER BY ROWNUM
Output
RN ID PROD_ID PRNT_ID
1 Id_359328 101265
2 Id_359329 101788 Id_359328
3 Id_359330 175 Id_359329
4 Id_359331 101766 Id_359329
5 Id_388909 100654 Id_359328
6 Id_388191 100672 Id_359328
7 Id_388927 100625 Id_359328
8 Id_359332 101766 Id_359328
9 Id_359380 100651 Id_359332
10 Id_359334 100643 Id_359332
11 Id_359337 101788 Id_359334
12 Id_359338 175 Id_359337
13 Id_359339 101766 Id_359337
14 Id_359336 101860 Id_359332Edited by: ravit on Apr 20, 2010 4:43 PMHi,
I agree with damorgan, XQuery processing requires some ressources and it could help to have some of your system specs and settings.
Anyway, tuning is not my specialty but I can give you an alternative.
You could move the XQuery logic to an XSLT stylesheet and transform the document before passing it to XMLTable.
For example :
Creating sample data like yours...
CREATE TABLE test_tree AS
SELECT n,
power(10,p)*(1+trunc(n/power(10,p))) p
FROM (
SELECT level n,
nvl(length(regexp_substr(level,'0+$')),0)+1 p
FROM dual
CONNECT BY level < 10000
UNION ALL
SELECT 10000, null FROM dual
CREATE TABLE test_xml (
doc1 xmltype,
doc2 xmltype
DECLARE
ctx dbms_xmlgen.ctxHandle;
doc xmltype;
xsl xmltype := xmltype(
'<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="/">
<root>
<xsl:apply-templates/>
</root>
</xsl:template>
<xsl:template match="*">
<ROW Id="{name(.)}">
<PROD_ID><xsl:value-of select="@prodId"/></PROD_ID>
<PRNT_ID><xsl:value-of select="name(..)"/></PRNT_ID>
</ROW>
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>'
BEGIN
-- hierarchical XML generation :
ctx := dbms_xmlgen.newContextFromHierarchy(
'select level,
xmlelement(evalname(''Id_''||to_char(n,''fm09999'')),
xmlattributes( to_char(n) as "prodId",
''C''||to_char(n) as "prodName" )
from test_tree
connect by prior n = p
start with p is null'
doc := dbms_xmlgen.getXMLType(ctx);
dbms_xmlgen.closeContext(ctx);
INSERT INTO test_xml VALUES(doc, doc.transform(xsl));
COMMIT;
END;
/Now, TEST_XML.DOC1 holds the original document, DOC2 holds the result of the transformation :
<root>
<ROW Id="Id_10000">
<PROD_ID>10000</PROD_ID>
<PRNT_ID>#document</PRNT_ID>
</ROW>
<ROW Id="Id_01000">
<PROD_ID>1000</PROD_ID>
<PRNT_ID>Id_10000</PRNT_ID>
</ROW>
<ROW Id="Id_00100">
<PROD_ID>100</PROD_ID>
<PRNT_ID>Id_01000</PRNT_ID>
</ROW>
<ROW Id="Id_00010">
<PROD_ID>10</PROD_ID>
<PRNT_ID>Id_00100</PRNT_ID>
</ROW>
<ROW Id="Id_09997">
<PROD_ID>9997</PROD_ID>
<PRNT_ID>Id_10000</PRNT_ID>
</ROW>
<ROW Id="Id_09998">
<PROD_ID>9998</PROD_ID>
<PRNT_ID>Id_10000</PRNT_ID>
</ROW>
<ROW Id="Id_09999">
<PROD_ID>9999</PROD_ID>
<PRNT_ID>Id_10000</PRNT_ID>
</ROW>
</root>Then we can execute the query on DOC2:
SELECT rn, id, prod_id, prnt_id
FROM test_xml x,
XMLTable(
'/root/ROW'
passing x.doc2
columns
id VARCHAR2(100) path '@Id',
prod_id NUMBER path 'PROD_ID',
prnt_id VARCHAR2(100) path 'PRNT_ID',
rn FOR ORDINALITY
;On my environment, 10000 records fetched in about 18s. -
How to insert large xml data into database tables.
Hi all,
iam new to xml. i want to insert data in xml file to my database tables.but the xml file size is very large. performance is also one of the issue. can anybody please tell me the procedure to take xml file from the server and insert into my database tables.
Thanks in advanceUnfortunately posting very generic questions like this in the forum tends not to be very productive for you, me or the other people who read the forum. It really helps everyone if you take a little time to review existing posts and their answers before starting new threads which replicate subjects that have already been discussed extensively in previous threads. This allows you to ask more sensible questions (eg, I'm using this approach and encountering this problem) rather than extremely generic questions that you can answer yourself by spending a little time reviewing existings posts or using the forum's search feature.
Also in future your might want to try being a little more specific before posting questions
Eg Define "very large". I know of customers who thing very large is 100K, and customers who think 4G is medium. I cannot tell from your post what size your files are.
What is the content of the file. Is it going to be loaded into a single record, or a a single table, or will it need to be loaded into multiple records in a single table or multiple records in multiple tables ?
Do you really need to load the data into exsiting relational tables or could your application work with relational views of the XML Content.
Finally which release of the database are you working with.
Define performance. Is it reasonable to expect to process this kind of document on this machine (Make, memory, #number of CPUs, CPU Speed, number of discs) in this period of time.
WRT to your original question. If you take a few minutes to search this forum you will find a very large number of threads with very similar titles to yours. These theads document a number of different approaches that can be used to solve this problem.
I suggest you start by looking for threads that cover topics like DBMS_XMLSTORE, XMLTable(), Relational Views of XML content, loading XML content in relational tables. -
Retrieving data from a relational table and CLOB as a whole XML file
I created the table lob_example and I have managed to insert XML document into it using XML SQL Utility. In this document I put contents of <DESCRIPTION> tag into CDATA section.
LOB_EXAMPLE
Name Null? Type
ID NOT NULL NUMBER
DESCRIPTION CLOB
NAME VARCHAR2(40)
But I could not retrieve this data properly. I can think of only one solution - to parse and build the whole XMLDocument. I found the suggestion of another solution to use Oracle8i views to do that in http://technet.oracle.com/tech/xml/infoocs/otnwp/about_oracle_xml_products.htm, but this text is not clear enough for me.
I would like to quote the fragment from document mentioned above, which is ambiguous for me:
"Combining XML Documents and Data Using Views
Finally, if you have a combination of structured and unstructured XML data, but still want to view and operate on it as a whole, you can use Oracle8i views. Views enable you to construct an object on the "fly" by combining XML data stored in a variety of ways. So, you can store structured data (such as employee data, customer data, and so on) in one location within object -relational tables, and store related unstructured data (such as descriptions and comments) within a CLOB. When you need to retrieve the data as a whole, you simply construct the structure from the various pieces of data with the use of type constructors in the view's select statement. The XML SQL Utility then enables retrieving the constructed data from the view as a single XML document."
The main question is - how to use type constructors in the view's select statement?Hello
Sorry for asking the same question again, but any responses would be greatly appreciated.
How to use type constructors in the view's select statement?
I could not find any answers for this question on Technet. Maybe the other approaches are more efficient to combine the part of data from CLOB with data from other column types?
Thank you -
Select data from an XML Column in a Relational Table
Hi guys,
I read a lot of documentation from Oracle how to select xml nodes from an XML Table. The following statement works perfectly for an XML table.
select extract(OBJECT_VALUE, '/loop/loop_data/description') "DESCRIPTION"
from loop_table
where xmlexists('/loop/loop_data[type_code="212"]' PASSING OBJECT_VALUE);
BUT: how to select xml nodes (data) from a relational table with an XML column???
I'm interested in the xml data.
Thanks!
MiroI've tried the same but i don't get any results
WITH BOL_JMS_MESSAGES_TMP AS
(SELECT 1 pk,
XMLTYPE('<MESSAGE_ENVELOPE>
<ORDER>
<DIRECT_TURNOVER>N</DIRECT_TURNOVER>
<DATE_PLACED>2010-05-06T17:14:35.189+02:00</DATE_PLACED>
<PAYMENT_TYPE>02</PAYMENT_TYPE>
<ACCOUNT_NUMBER>108317412</ACCOUNT_NUMBER>
<GIFT_FLAG>N</GIFT_FLAG>
<ID>7788783900</ID>
<NETPRICE>117.21</NETPRICE>
<VAT>7.69</VAT>
<TOTALPRICE>126.85</TOTALPRICE>
<SHIPHAND_COSTS>1.64</SHIPHAND_COSTS>
<SHIPHAND_VAT>0.31</SHIPHAND_VAT>
<SHIPEQUALBILL_FLAG>Y</SHIPEQUALBILL_FLAG>
<SHIPPING_METHOD>01</SHIPPING_METHOD>
</ORDER>
</MESSAGE_ENVELOPE>') rnd_col
from dual
select extract(rnd_col, '/message_envelope/order/direct_turnover/date_placed/payment_type/account_number/gift_flag/id/netprice/vat/totalprice/shiphand_costs/shiphand_vat/shipequalbill_flag/SHIPPING_METHOD') "Payment type"
FROM BOL_JMS_MESSAGES_TMP
WHERE existsNode(rnd_col,'/message_envelope') = 1;
No rows.
Eventually i want to update the payment type from 02 to 00. -
How to create XML from relational tables based on an XML Schema ?
There is no automated way in Oracle XML DB to define an automatic mapping between a set of columns in some existing relational tables and the elements and attributres defined by an XML Schema.
However it is easy solve this problem by using the SQL/XML operators (XMLAGG, XMLELEMENT, XMLFOREST, XMLATTRIBUTES, etc) to generate XML documents that are compliant with an XML Schema directly from a SQL statement.
If the XML Schema is registered with Oracle XML DB and the appropraite Schema Location information is added into the generated document using XMLAttributes then it becomes very easy to ensure that the generated documents are valid.
The following example show an easy way to do this by creating an XML View that contains the documents to be validated.
SQL> drop table PURCHASEORDER_LINEITEM
2 /
Table dropped.
SQL> drop table PURCHASEORDER_REJECTION
2 /
Table dropped.
SQL> drop table PURCHASEORDER_SHIPPING
2 /
Table dropped.
SQL> drop TABLE PURCHASEORDER_ACTION
2 /
Table dropped.
SQL> drop TABLE PURCHASEORDER_TABLE
2 /
Table dropped.
SQL> create table PURCHASEORDER_TABLE
2 (
3 REFERENCE VARCHAR2(28),
4 PRIMARY KEY ("REFERENCE"),
5 REQUESTER VARCHAR2(48),
6 USERID VARCHAR2(32),
7 COSTCENTER VARCHAR2(3),
8 SPECIALINSTRUCTIONS VARCHAR2(2048)
9 )
10 /
Table created.
SQL> create table PURCHASEORDER_ACTION
2 (
3 REFERENCE,
4 FOREIGN KEY ("REFERENCE") REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
5 ACTIONEDBY VARCHAR2(32),
6 DATEACTIONED DATE
7 )
8 /
Table created.
SQL> create table PURCHASEORDER_SHIPPING
2 (
3 REFERENCE,
4 FOREIGN KEY ("REFERENCE") REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
5 PRIMARY KEY ("REFERENCE"),
6 SHIPTONAME VARCHAR2(48),
7 ADDRESS VARCHAR2(512),
8 PHONE VARCHAR2(32)
9 )
10 /
Table created.
SQL> create table PURCHASEORDER_REJECTION
2 (
3 REFERENCE,
4 FOREIGN KEY ("REFERENCE") REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
5 PRIMARY KEY ("REFERENCE"),
6 REJECTEDBY VARCHAR2(32),
7 DATEREJECTED DATE,
8 COMMENTS VARCHAR2(2048)
9 )
10 /
Table created.
SQL> create table PURCHASEORDER_LINEITEM
2 (
3 REFERENCE,
4 FOREIGN KEY ("REFERENCE") REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
5 LINENO NUMBER(10),
6 PRIMARY KEY ("REFERENCE","LINENO"),
7 UPC VARCHAR2(14),
8 DESCRIPTION VARCHAR2(128),
9 QUANTITY NUMBER(10),
10 UNITPRICE NUMBER(12,2)
11 )
12 /
Table created.
SQL> insert into PURCHASEORDER_TABLE values ('SMCCAIN-20030109123335470PDT','Samuel B. McCain','SMCCAIN','A10','Courier')
2 /
1 row created.
SQL> insert into PURCHASEORDER_ACTION values ('SMCCAIN-20030109123335470PDT','SVOLLMAN',NULL)
2 /
1 row created.
SQL> insert into PURCHASEORDER_SHIPPING values ('SMCCAIN-20030109123335470PDT','Samuel B. McCain','800 Bridge Parkway,Redwood Shores,CA,9406
5,USA','650 506 7800')
2 /
1 row created.
SQL> insert into PURCHASEORDER_REJECTION values ('SMCCAIN-20030109123335470PDT',null,null,null)
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','1','715515010320','Life of Brian - Monty Python''s','2','39.
95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','2','37429145227','The Night Porter','2','29.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','3','37429128121','Oliver Twist','1','39.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','4','715515012720','Notorious','4','39.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','5','715515012928','In the Mood for Love','3','39.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','6','37429130926','Alphaville','2','29.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','7','37429166529','General Idi Amin Dada','4','29.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','8','715515012928','In the Mood for Love','3','39.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','9','715515009423','Flesh for Frankenstein','3','39.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','10','715515008976','The Killer','1','39.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','11','37429167922','Ballad of a Soldier','2','29.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','12','37429158623','Ordet','2','0')
2 /
1 row created.
SQL> var schemaPath varchar2(256)
SQL> --
SQL> begin
2 :schemaURL := 'http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd';
3 :schemaPath := '/public/purchaseOrder.xsd';
4 end;
5 /
PL/SQL procedure successfully completed.
SQL> call dbms_xmlSchema.deleteSchema(:schemaURL,4)
2 /
Call completed.
SQL> declare
2 res boolean;
3 xmlSchema xmlType := xmlType(
4 '<!-- edited with XML Spy v4.0 U (http://www.xmlspy.com) by Mark (Drake) -->
5 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0" xdb:storeVarrayAsTable="tr
ue">
6 <xs:element name="PurchaseOrder" type="PurchaseOrderType" xdb:defaultTable="PURCHASEORDER"/>
7 <xs:complexType name="PurchaseOrderType" xdb:SQLType="PURCHASEORDER_T" xdb:maintainDOM="false">
8 <xs:sequence>
9 <xs:element name="Reference" type="ReferenceType" xdb:SQLName="REFERENCE"/>
10 <xs:element name="Actions" type="ActionsType" xdb:SQLName="ACTIONS"/>
11 <xs:element name="Reject" type="RejectionType" minOccurs="0" xdb:SQLName="REJECTION"/>
12 <xs:element name="Requestor" type="RequestorType" xdb:SQLName="REQUESTOR"/>
13 <xs:element name="User" type="UserType" xdb:SQLName="USERID"/>
14 <xs:element name="CostCenter" type="CostCenterType" xdb:SQLName="COST_CENTER"/>
15 <xs:element name="ShippingInstructions" type="ShippingInstructionsType" xdb:SQLName="SHIPPING_INSTRUCTIONS"/>
16 <xs:element name="SpecialInstructions" type="SpecialInstructionsType" xdb:SQLName="SPECIAL_INSTRUCTIONS"/>
17 <xs:element name="LineItems" type="LineItemsType" xdb:SQLName="LINEITEMS"/>
18 </xs:sequence>
19 </xs:complexType>
20 <xs:complexType name="LineItemsType" xdb:SQLType="LINEITEMS_T" xdb:maintainDOM="false">
21 <xs:sequence>
22 <xs:element name="LineItem" type="LineItemType" maxOccurs="unbounded" xdb:SQLName="LINEITEM" xdb:SQLCollType="L
INEITEM_V"/>
23 </xs:sequence>
24 </xs:complexType>
25 <xs:complexType name="LineItemType" xdb:SQLType="LINEITEM_T" xdb:maintainDOM="false">
26 <xs:sequence>
27 <xs:element name="Description" type="DescriptionType" xdb:SQLName="DESRIPTION"/>
28 <xs:element name="Part" type="PartType" xdb:SQLName="PART"/>
29 </xs:sequence>
30 <xs:attribute name="ItemNumber" type="xs:integer" xdb:SQLName="ITEMNUMBER" xdb:SQLType="NUMBER"/>
31 </xs:complexType>
32 <xs:complexType name="PartType" xdb:SQLType="PART_T" xdb:maintainDOM="false">
33 <xs:attribute name="Id" xdb:SQLName="PART_NUMBER" xdb:SQLType="VARCHAR2">
34 <xs:simpleType>
35 <xs:restriction base="xs:string">
36 <xs:minLength value="10"/>
37 <xs:maxLength value="14"/>
38 </xs:restriction>
39 </xs:simpleType>
40 </xs:attribute>
41 <xs:attribute name="Quantity" type="moneyType" xdb:SQLName="QUANTITY"/>
42 <xs:attribute name="UnitPrice" type="quantityType" xdb:SQLName="UNITPRICE"/>
43 </xs:complexType>
44 <xs:simpleType name="ReferenceType">
45 <xs:restriction base="xs:string">
46 <xs:minLength value="18"/>
47 <xs:maxLength value="30"/>
48 </xs:restriction>
49 </xs:simpleType>
50 <xs:complexType name="ActionsType" xdb:SQLType="ACTIONS_T" xdb:maintainDOM="false">
51 <xs:sequence>
52 <xs:element name="Action" maxOccurs="4" xdb:SQLName="ACTION" xdb:SQLCollType="ACTION_V">
53 <xs:complexType xdb:SQLType="ACTION_T" xdb:maintainDOM="false">
54 <xs:sequence>
55 <xs:element name="User" type="UserType" xdb:SQLName="ACTIONED_BY"/>
56 <xs:element name="Date" type="DateType" minOccurs="0" xdb:SQLName="DATE_ACTIONED"/>
57 </xs:sequence>
58 </xs:complexType>
59 </xs:element>
60 </xs:sequence>
61 </xs:complexType>
62 <xs:complexType name="RejectionType" xdb:SQLType="REJECTION_T" xdb:maintainDOM="false">
63 <xs:all>
64 <xs:element name="User" type="UserType" minOccurs="0" xdb:SQLName="REJECTED_BY"/>
65 <xs:element name="Date" type="DateType" minOccurs="0" xdb:SQLName="DATE_REJECTED"/>
66 <xs:element name="Comments" type="CommentsType" minOccurs="0" xdb:SQLName="REASON_REJECTED"/>
67 </xs:all>
68 </xs:complexType>
69 <xs:complexType name="ShippingInstructionsType" xdb:SQLType="SHIPPING_INSTRUCTIONS_T" xdb:maintainDOM="false">
70 <xs:sequence>
71 <xs:element name="name" type="NameType" minOccurs="0" xdb:SQLName="SHIP_TO_NAME"/>
72 <xs:element name="address" type="AddressType" minOccurs="0" xdb:SQLName="SHIP_TO_ADDRESS"/>
73 <xs:element name="telephone" type="TelephoneType" minOccurs="0" xdb:SQLName="SHIP_TO_PHONE"/>
74 </xs:sequence>
75 </xs:complexType>
76 <xs:simpleType name="moneyType">
77 <xs:restriction base="xs:decimal">
78 <xs:fractionDigits value="2"/>
79 <xs:totalDigits value="12"/>
80 </xs:restriction>
81 </xs:simpleType>
82 <xs:simpleType name="quantityType">
83 <xs:restriction base="xs:decimal">
84 <xs:fractionDigits value="4"/>
85 <xs:totalDigits value="8"/>
86 </xs:restriction>
87 </xs:simpleType>
88 <xs:simpleType name="UserType">
89 <xs:restriction base="xs:string">
90 <xs:minLength value="1"/>
91 <xs:maxLength value="10"/>
92 </xs:restriction>
93 </xs:simpleType>
94 <xs:simpleType name="RequestorType">
95 <xs:restriction base="xs:string">
96 <xs:minLength value="0"/>
97 <xs:maxLength value="128"/>
98 </xs:restriction>
99 </xs:simpleType>
100 <xs:simpleType name="CostCenterType">
101 <xs:restriction base="xs:string">
102 <xs:minLength value="1"/>
103 <xs:maxLength value="4"/>
104 </xs:restriction>
105 </xs:simpleType>
106 <xs:simpleType name="VendorType">
107 <xs:restriction base="xs:string">
108 <xs:minLength value="0"/>
109 <xs:maxLength value="20"/>
110 </xs:restriction>
111 </xs:simpleType>
112 <xs:simpleType name="PurchaseOrderNumberType">
113 <xs:restriction base="xs:integer"/>
114 </xs:simpleType>
115 <xs:simpleType name="SpecialInstructionsType">
116 <xs:restriction base="xs:string">
117 <xs:minLength value="0"/>
118 <xs:maxLength value="2048"/>
119 </xs:restriction>
120 </xs:simpleType>
121 <xs:simpleType name="NameType">
122 <xs:restriction base="xs:string">
123 <xs:minLength value="1"/>
124 <xs:maxLength value="20"/>
125 </xs:restriction>
126 </xs:simpleType>
127 <xs:simpleType name="AddressType">
128 <xs:restriction base="xs:string">
129 <xs:minLength value="1"/>
130 <xs:maxLength value="256"/>
131 </xs:restriction>
132 </xs:simpleType>
133 <xs:simpleType name="TelephoneType">
134 <xs:restriction base="xs:string">
135 <xs:minLength value="1"/>
136 <xs:maxLength value="24"/>
137 </xs:restriction>
138 </xs:simpleType>
139 <xs:simpleType name="DateType">
140 <xs:restriction base="xs:date"/>
141 </xs:simpleType>
142 <xs:simpleType name="CommentsType">
143 <xs:restriction base="xs:string">
144 <xs:minLength value="1"/>
145 <xs:maxLength value="2048"/>
146 </xs:restriction>
147 </xs:simpleType>
148 <xs:simpleType name="DescriptionType">
149 <xs:restriction base="xs:string">
150 <xs:minLength value="1"/>
151 <xs:maxLength value="256"/>
152 </xs:restriction>
153 </xs:simpleType>
154 </xs:schema>
155 ');
156 begin
157 if (dbms_xdb.existsResource(:schemaPath)) then
158 dbms_xdb.deleteResource(:schemaPath);
159 end if;
160 res := dbms_xdb.createResource(:schemaPath,xmlSchema);
161 end;
162 /
PL/SQL procedure successfully completed.
SQL> begin
2 dbms_xmlschema.registerSchema
3 (
4 :schemaURL,
5 xdbURIType(:schemaPath).getClob(),
6 TRUE,TRUE,FALSE,FALSE
7 );
8 end;
9 /
PL/SQL procedure successfully completed.
SQL> create or replace view PURCHASEORDER_XML
2 of xmltype
3 xmlSCHEMA "http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd" Element "PurchaseOrder"
4 with object id
5 (
6 substr(extractValue(object_value,'/PurchaseOrder/Reference'),1,32)
7 )
8 as
9 select xmlElement
10 (
11 "PurchaseOrder",
12 xmlAttributes
13 (
14 'http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd' as "xsi:noNamespaceSchemaLocation",
15 'http://www.w3.org/2001/XMLSchema-instance' as "xmlns:xsi"
16 ),
17 xmlElement("Reference",p.REFERENCE),
18 xmlElement
19 (
20 "Actions",
21 ( select xmlAgg
22 (
23 xmlElement
24 (
25 "Action",
26 xmlElement("User",ACTIONEDBY),
27 case
28 when DATEACTIONED is not null
29 then xmlElement("Date",DATEACTIONED)
30 end
31 )
32 )
33 from PURCHASEORDER_ACTION a
34 where a.REFERENCE = p.REFERENCE
35 )
36 ),
37 xmlElement
38 (
39 "Reject",
40 xmlForest
41 (
42 REJECTEDBY as "User",
43 DATEREJECTED as "Date",
44 COMMENTS as "Comments"
45 )
46 ),
47 xmlElement("Requestor",REQUESTER),
48 xmlElement("User",USERID),
49 xmlElement("CostCenter",COSTCENTER),
50 xmlElement
51 (
52 "ShippingInstructions",
53 xmlElement("name",SHIPTONAME),
54 xmlElement("address",ADDRESS),
55 xmlElement("telephone",PHONE)
56 ),
57 xmlElement("SpecialInstructions",SPECIALINSTRUCTIONS),
58 xmlElement
59 (
60 "LineItems",
61 ( select xmlAgg
62 (
63 xmlElement
64 (
65 "LineItem",
66 xmlAttributes(LINENO as "ItemNumber"),
67 xmlElement("Description",DESCRIPTION),
68 xmlElement
69 (
70 "Part",
71 xmlAttributes
72 (
73 UPC as "Id",
74 QUANTITY as "Quantity",
75 UNITPRICE as "UnitPrice"
76 )
77 )
78 )
79 )
80 from PURCHASEORDER_LINEITEM l
81 where l.REFERENCE = p.REFERENCE
82 )
83 )
84 )
85 from PURCHASEORDER_TABLE p, PURCHASEORDER_REJECTION r, PURCHASEORDER_SHIPPING s
86 where r.REFERENCE = p.REFERENCE
87 and s.REFERENCE = p.REFERENCE
88 /
View created.
SQL> set long 10000 pages 0 lines 140
SQL> --
SQL> select x.object_value.extract('/*')
2 from PURCHASEORDER_XML x
3 /
<PurchaseOrder xsi:noNamespaceSchemaLocation="http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Reference>SMCCAIN-20030109123335470PDT</Reference>
<Actions>
<Action>
<User>SVOLLMAN</User>
</Action>
</Actions>
<Reject/>
<Requestor>Samuel B. McCain</Requestor>
<User>SMCCAIN</User>
<CostCenter>A10</CostCenter>
<ShippingInstructions>
<name>Samuel B. McCain</name>
<address>800 Bridge Parkway,Redwood Shores,CA,94065,USA</address>
<telephone>650 506 7800</telephone>
</ShippingInstructions>
<SpecialInstructions>Courier</SpecialInstructions>
<LineItems>
<LineItem ItemNumber="1">
<Description>Life of Brian - Monty Python's</Description>
<Part Id="715515010320" Quantity="2" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="2">
<Description>The Night Porter</Description>
<Part Id="37429145227" Quantity="2" UnitPrice="29.95"/>
</LineItem>
<LineItem ItemNumber="3">
<Description>Oliver Twist</Description>
<Part Id="37429128121" Quantity="1" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="4">
<Description>Notorious</Description>
<Part Id="715515012720" Quantity="4" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="5">
<Description>In the Mood for Love</Description>
<Part Id="715515012928" Quantity="3" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="6">
<Description>Alphaville</Description>
<Part Id="37429130926" Quantity="2" UnitPrice="29.95"/>
</LineItem>
<LineItem ItemNumber="7">
<Description>General Idi Amin Dada</Description>
<Part Id="37429166529" Quantity="4" UnitPrice="29.95"/>
</LineItem>
<LineItem ItemNumber="8">
<Description>In the Mood for Love</Description>
<Part Id="715515012928" Quantity="3" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="9">
<Description>Flesh for Frankenstein</Description>
<Part Id="715515009423" Quantity="3" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="10">
<Description>The Killer</Description>
<Part Id="715515008976" Quantity="1" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="11">
<Description>Ballad of a Soldier</Description>
<Part Id="37429167922" Quantity="2" UnitPrice="29.95"/>
</LineItem>
<LineItem ItemNumber="12">
<Description>Ordet</Description>
<Part Id="37429158623" Quantity="2" UnitPrice="0"/>
</LineItem>
</LineItems>
</PurchaseOrder>
SQL> begin
2 for x in (select object_value from PURCHASEORDER_XML) loop
3 x.object_value.schemaValidate();
4 end loop;
5 end;
6 /
PL/SQL procedure successfully completed.
SQL>There is no automated way in Oracle XML DB to define an automatic mapping between a set of columns in some existing relational tables and the elements and attributres defined by an XML Schema.
However it is easy solve this problem by using the SQL/XML operators (XMLAGG, XMLELEMENT, XMLFOREST, XMLATTRIBUTES, etc) to generate XML documents that are compliant with an XML Schema directly from a SQL statement.
If the XML Schema is registered with Oracle XML DB and the appropraite Schema Location information is added into the generated document using XMLAttributes then it becomes very easy to ensure that the generated documents are valid.
The following example show an easy way to do this by creating an XML View that contains the documents to be validated.
SQL> drop table PURCHASEORDER_LINEITEM
2 /
Table dropped.
SQL> drop table PURCHASEORDER_REJECTION
2 /
Table dropped.
SQL> drop table PURCHASEORDER_SHIPPING
2 /
Table dropped.
SQL> drop TABLE PURCHASEORDER_ACTION
2 /
Table dropped.
SQL> drop TABLE PURCHASEORDER_TABLE
2 /
Table dropped.
SQL> create table PURCHASEORDER_TABLE
2 (
3 REFERENCE VARCHAR2(28),
4 PRIMARY KEY ("REFERENCE"),
5 REQUESTER VARCHAR2(48),
6 USERID VARCHAR2(32),
7 COSTCENTER VARCHAR2(3),
8 SPECIALINSTRUCTIONS VARCHAR2(2048)
9 )
10 /
Table created.
SQL> create table PURCHASEORDER_ACTION
2 (
3 REFERENCE,
4 FOREIGN KEY ("REFERENCE") REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
5 ACTIONEDBY VARCHAR2(32),
6 DATEACTIONED DATE
7 )
8 /
Table created.
SQL> create table PURCHASEORDER_SHIPPING
2 (
3 REFERENCE,
4 FOREIGN KEY ("REFERENCE") REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
5 PRIMARY KEY ("REFERENCE"),
6 SHIPTONAME VARCHAR2(48),
7 ADDRESS VARCHAR2(512),
8 PHONE VARCHAR2(32)
9 )
10 /
Table created.
SQL> create table PURCHASEORDER_REJECTION
2 (
3 REFERENCE,
4 FOREIGN KEY ("REFERENCE") REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
5 PRIMARY KEY ("REFERENCE"),
6 REJECTEDBY VARCHAR2(32),
7 DATEREJECTED DATE,
8 COMMENTS VARCHAR2(2048)
9 )
10 /
Table created.
SQL> create table PURCHASEORDER_LINEITEM
2 (
3 REFERENCE,
4 FOREIGN KEY ("REFERENCE") REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
5 LINENO NUMBER(10),
6 PRIMARY KEY ("REFERENCE","LINENO"),
7 UPC VARCHAR2(14),
8 DESCRIPTION VARCHAR2(128),
9 QUANTITY NUMBER(10),
10 UNITPRICE NUMBER(12,2)
11 )
12 /
Table created.
SQL> insert into PURCHASEORDER_TABLE values ('SMCCAIN-20030109123335470PDT','Samuel B. McCain','SMCCAIN','A10','Courier')
2 /
1 row created.
SQL> insert into PURCHASEORDER_ACTION values ('SMCCAIN-20030109123335470PDT','SVOLLMAN',NULL)
2 /
1 row created.
SQL> insert into PURCHASEORDER_SHIPPING values ('SMCCAIN-20030109123335470PDT','Samuel B. McCain','800 Bridge Parkway,Redwood Shores,CA,9406
5,USA','650 506 7800')
2 /
1 row created.
SQL> insert into PURCHASEORDER_REJECTION values ('SMCCAIN-20030109123335470PDT',null,null,null)
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','1','715515010320','Life of Brian - Monty Python''s','2','39.
95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','2','37429145227','The Night Porter','2','29.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','3','37429128121','Oliver Twist','1','39.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','4','715515012720','Notorious','4','39.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','5','715515012928','In the Mood for Love','3','39.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','6','37429130926','Alphaville','2','29.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','7','37429166529','General Idi Amin Dada','4','29.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','8','715515012928','In the Mood for Love','3','39.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','9','715515009423','Flesh for Frankenstein','3','39.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','10','715515008976','The Killer','1','39.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','11','37429167922','Ballad of a Soldier','2','29.95')
2 /
1 row created.
SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','12','37429158623','Ordet','2','0')
2 /
1 row created.
SQL> var schemaPath varchar2(256)
SQL> --
SQL> begin
2 :schemaURL := 'http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd';
3 :schemaPath := '/public/purchaseOrder.xsd';
4 end;
5 /
PL/SQL procedure successfully completed.
SQL> call dbms_xmlSchema.deleteSchema(:schemaURL,4)
2 /
Call completed.
SQL> declare
2 res boolean;
3 xmlSchema xmlType := xmlType(
4 '<!-- edited with XML Spy v4.0 U (http://www.xmlspy.com) by Mark (Drake) -->
5 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0" xdb:storeVarrayAsTable="tr
ue">
6 <xs:element name="PurchaseOrder" type="PurchaseOrderType" xdb:defaultTable="PURCHASEORDER"/>
7 <xs:complexType name="PurchaseOrderType" xdb:SQLType="PURCHASEORDER_T" xdb:maintainDOM="false">
8 <xs:sequence>
9 <xs:element name="Reference" type="ReferenceType" xdb:SQLName="REFERENCE"/>
10 <xs:element name="Actions" type="ActionsType" xdb:SQLName="ACTIONS"/>
11 <xs:element name="Reject" type="RejectionType" minOccurs="0" xdb:SQLName="REJECTION"/>
12 <xs:element name="Requestor" type="RequestorType" xdb:SQLName="REQUESTOR"/>
13 <xs:element name="User" type="UserType" xdb:SQLName="USERID"/>
14 <xs:element name="CostCenter" type="CostCenterType" xdb:SQLName="COST_CENTER"/>
15 <xs:element name="ShippingInstructions" type="ShippingInstructionsType" xdb:SQLName="SHIPPING_INSTRUCTIONS"/>
16 <xs:element name="SpecialInstructions" type="SpecialInstructionsType" xdb:SQLName="SPECIAL_INSTRUCTIONS"/>
17 <xs:element name="LineItems" type="LineItemsType" xdb:SQLName="LINEITEMS"/>
18 </xs:sequence>
19 </xs:complexType>
20 <xs:complexType name="LineItemsType" xdb:SQLType="LINEITEMS_T" xdb:maintainDOM="false">
21 <xs:sequence>
22 <xs:element name="LineItem" type="LineItemType" maxOccurs="unbounded" xdb:SQLName="LINEITEM" xdb:SQLCollType="L
INEITEM_V"/>
23 </xs:sequence>
24 </xs:complexType>
25 <xs:complexType name="LineItemType" xdb:SQLType="LINEITEM_T" xdb:maintainDOM="false">
26 <xs:sequence>
27 <xs:element name="Description" type="DescriptionType" xdb:SQLName="DESRIPTION"/>
28 <xs:element name="Part" type="PartType" xdb:SQLName="PART"/>
29 </xs:sequence>
30 <xs:attribute name="ItemNumber" type="xs:integer" xdb:SQLName="ITEMNUMBER" xdb:SQLType="NUMBER"/>
31 </xs:complexType>
32 <xs:complexType name="PartType" xdb:SQLType="PART_T" xdb:maintainDOM="false">
33 <xs:attribute name="Id" xdb:SQLName="PART_NUMBER" xdb:SQLType="VARCHAR2">
34 <xs:simpleType>
35 <xs:restriction base="xs:string">
36 <xs:minLength value="10"/>
37 <xs:maxLength value="14"/>
38 </xs:restriction>
39 </xs:simpleType>
40 </xs:attribute>
41 <xs:attribute name="Quantity" type="moneyType" xdb:SQLName="QUANTITY"/>
42 <xs:attribute name="UnitPrice" type="quantityType" xdb:SQLName="UNITPRICE"/>
43 </xs:complexType>
44 <xs:simpleType name="ReferenceType">
45 <xs:restriction base="xs:string">
46 <xs:minLength value="18"/>
47 <xs:maxLength value="30"/>
48 </xs:restriction>
49 </xs:simpleType>
50 <xs:complexType name="ActionsType" xdb:SQLType="ACTIONS_T" xdb:maintainDOM="false">
51 <xs:sequence>
52 <xs:element name="Action" maxOccurs="4" xdb:SQLName="ACTION" xdb:SQLCollType="ACTION_V">
53 <xs:complexType xdb:SQLType="ACTION_T" xdb:maintainDOM="false">
54 <xs:sequence>
55 <xs:element name="User" type="UserType" xdb:SQLName="ACTIONED_BY"/>
56 <xs:element name="Date" type="DateType" minOccurs="0" xdb:SQLName="DATE_ACTIONED"/>
57 </xs:sequence>
58 </xs:complexType>
59 </xs:element>
60 </xs:sequence>
61 </xs:complexType>
62 <xs:complexType name="RejectionType" xdb:SQLType="REJECTION_T" xdb:maintainDOM="false">
63 <xs:all>
64 <xs:element name="User" type="UserType" minOccurs="0" xdb:SQLName="REJECTED_BY"/>
65 <xs:element name="Date" type="DateType" minOccurs="0" xdb:SQLName="DATE_REJECTED"/>
66 <xs:element name="Comments" type="CommentsType" minOccurs="0" xdb:SQLName="REASON_REJECTED"/>
67 </xs:all>
68 </xs:complexType>
69 <xs:complexType name="ShippingInstructionsType" xdb:SQLType="SHIPPING_INSTRUCTIONS_T" xdb:maintainDOM="false">
70 <xs:sequence>
71 <xs:element name="name" type="NameType" minOccurs="0" xdb:SQLName="SHIP_TO_NAME"/>
72 <xs:element name="address" type="AddressType" minOccurs="0" xdb:SQLName="SHIP_TO_ADDRESS"/>
73 <xs:element name="telephone" type="TelephoneType" minOccurs="0" xdb:SQLName="SHIP_TO_PHONE"/>
74 </xs:sequence>
75 </xs:complexType>
76 <xs:simpleType name="moneyType">
77 <xs:restriction base="xs:decimal">
78 <xs:fractionDigits value="2"/>
79 <xs:totalDigits value="12"/>
80 </xs:restriction>
81 </xs:simpleType>
82 <xs:simpleType name="quantityType">
83 <xs:restriction base="xs:decimal">
84 <xs:fractionDigits value="4"/>
85 <xs:totalDigits value="8"/>
86 </xs:restriction>
87 </xs:simpleType>
88 <xs:simpleType name="UserType">
89 <xs:restriction base="xs:string">
90 <xs:minLength value="1"/>
91 <xs:maxLength value="10"/>
92 </xs:restriction>
93 </xs:simpleType>
94 <xs:simpleType name="RequestorType">
95 <xs:restriction base="xs:string">
96 <xs:minLength value="0"/>
97 <xs:maxLength value="128"/>
98 </xs:restriction>
99 </xs:simpleType>
100 <xs:simpleType name="CostCenterType">
101 <xs:restriction base="xs:string">
102 <xs:minLength value="1"/>
103 <xs:maxLength value="4"/>
104 </xs:restriction>
105 </xs:simpleType>
106 <xs:simpleType name="VendorType">
107 <xs:restriction base="xs:string">
108 <xs:minLength value="0"/>
109 <xs:maxLength value="20"/>
110 </xs:restriction>
111 </xs:simpleType>
112 <xs:simpleType name="PurchaseOrderNumberType">
113 <xs:restriction base="xs:integer"/>
114 </xs:simpleType>
115 <xs:simpleType name="SpecialInstructionsType">
116 <xs:restriction base="xs:string">
117 <xs:minLength value="0"/>
118 <xs:maxLength value="2048"/>
119 </xs:restriction>
120 </xs:simpleType>
121 <xs:simpleType name="NameType">
122 <xs:restriction base="xs:string">
123 <xs:minLength value="1"/>
124 <xs:maxLength value="20"/>
125 </xs:restriction>
126 </xs:simpleType>
127 <xs:simpleType name="AddressType">
128 <xs:restriction base="xs:string">
129 <xs:minLength value="1"/>
130 <xs:maxLength value="256"/>
131 </xs:restriction>
132 </xs:simpleType>
133 <xs:simpleType name="TelephoneType">
134 <xs:restriction base="xs:string">
135 <xs:minLength value="1"/>
136 <xs:maxLength value="24"/>
137 </xs:restriction>
138 </xs:simpleType>
139 <xs:simpleType name="DateType">
140 <xs:restriction base="xs:date"/>
141 </xs:simpleType>
142 <xs:simpleType name="CommentsType">
143 <xs:restriction base="xs:string">
144 <xs:minLength value="1"/>
145 <xs:maxLength value="2048"/>
146 </xs:restriction>
147 </xs:simpleType>
148 <xs:simpleType name="DescriptionType">
149 <xs:restriction base="xs:string">
150 <xs:minLength value="1"/>
151 <xs:maxLength value="256"/>
152 </xs:restriction>
153 </xs:simpleType>
154 </xs:schema>
155 ');
156 begin
157 if (dbms_xdb.existsResource(:schemaPath)) then
158 dbms_xdb.deleteResource(:schemaPath);
159 end if;
160 res := dbms_xdb.createResource(:schemaPath,xmlSchema);
161 end;
162 /
PL/SQL procedure successfully completed.
SQL> begin
2 dbms_xmlschema.registerSchema
3 (
4 :schemaURL,
5 xdbURIType(:schemaPath).getClob(),
6 TRUE,TRUE,FALSE,FALSE
7 );
8 end;
9 /
PL/SQL procedure successfully completed.
SQL> create or replace view PURCHASEORDER_XML
2 of xmltype
3 xmlSCHEMA "http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd" Element "PurchaseOrder"
4 with object id
5 (
6 substr(extractValue(object_value,'/PurchaseOrder/Reference'),1,32)
7 )
8 as
9 select xmlElement
10 (
11 "PurchaseOrder",
12 xmlAttributes
13 (
14 'http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd' as "xsi:noNamespaceSchemaLocation",
15 'http://www.w3.org/2001/XMLSchema-instance' as "xmlns:xsi"
16 ),
17 xmlElement("Reference",p.REFERENCE),
18 xmlElement
19 (
20 "Actions",
21 ( select xmlAgg
22 (
23 xmlElement
24 (
25 "Action",
26 xmlElement("User",ACTIONEDBY),
27 case
28 when DATEACTIONED is not null
29 then xmlElement("Date",DATEACTIONED)
30 end
31 )
32 )
33 from PURCHASEORDER_ACTION a
34 where a.REFERENCE = p.REFERENCE
35 )
36 ),
37 xmlElement
38 (
39 "Reject",
40 xmlForest
41 (
42 REJECTEDBY as "User",
43 DATEREJECTED as "Date",
44 COMMENTS as "Comments"
45 )
46 ),
47 xmlElement("Requestor",REQUESTER),
48 xmlElement("User",USERID),
49 xmlElement("CostCenter",COSTCENTER),
50 xmlElement
51 (
52 "ShippingInstructions",
53 xmlElement("name",SHIPTONAME),
54 xmlElement("address",ADDRESS),
55 xmlElement("telephone",PHONE)
56 ),
57 xmlElement("SpecialInstructions",SPECIALINSTRUCTIONS),
58 xmlElement
59 (
60 "LineItems",
61 ( select xmlAgg
62 (
63 xmlElement
64 (
65 "LineItem",
66 xmlAttributes(LINENO as "ItemNumber"),
67 xmlElement("Description",DESCRIPTION),
68 xmlElement
69 (
70 "Part",
71 xmlAttributes
72 (
73 UPC as "Id",
74 QUANTITY as "Quantity",
75 UNITPRICE as "UnitPrice"
76 )
77 )
78 )
79 )
80 from PURCHASEORDER_LINEITEM l
81 where l.REFERENCE = p.REFERENCE
82 )
83 )
84 )
85 from PURCHASEORDER_TABLE p, PURCHASEORDER_REJECTION r, PURCHASEORDER_SHIPPING s
86 where r.REFERENCE = p.REFERENCE
87 and s.REFERENCE = p.REFERENCE
88 /
View created.
SQL> set long 10000 pages 0 lines 140
SQL> --
SQL> select x.object_value.extract('/*')
2 from PURCHASEORDER_XML x
3 /
<PurchaseOrder xsi:noNamespaceSchemaLocation="http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Reference>SMCCAIN-20030109123335470PDT</Reference>
<Actions>
<Action>
<User>SVOLLMAN</User>
</Action>
</Actions>
<Reject/>
<Requestor>Samuel B. McCain</Requestor>
<User>SMCCAIN</User>
<CostCenter>A10</CostCenter>
<ShippingInstructions>
<name>Samuel B. McCain</name>
<address>800 Bridge Parkway,Redwood Shores,CA,94065,USA</address>
<telephone>650 506 7800</telephone>
</ShippingInstructions>
<SpecialInstructions>Courier</SpecialInstructions>
<LineItems>
<LineItem ItemNumber="1">
<Description>Life of Brian - Monty Python's</Description>
<Part Id="715515010320" Quantity="2" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="2">
<Description>The Night Porter</Description>
<Part Id="37429145227" Quantity="2" UnitPrice="29.95"/>
</LineItem>
<LineItem ItemNumber="3">
<Description>Oliver Twist</Description>
<Part Id="37429128121" Quantity="1" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="4">
<Description>Notorious</Description>
<Part Id="715515012720" Quantity="4" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="5">
<Description>In the Mood for Love</Description>
<Part Id="715515012928" Quantity="3" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="6">
<Description>Alphaville</Description>
<Part Id="37429130926" Quantity="2" UnitPrice="29.95"/>
</LineItem>
<LineItem ItemNumber="7">
<Description>General Idi Amin Dada</Description>
<Part Id="37429166529" Quantity="4" UnitPrice="29.95"/>
</LineItem>
<LineItem ItemNumber="8">
<Description>In the Mood for Love</Description>
<Part Id="715515012928" Quantity="3" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="9">
<Description>Flesh for Frankenstein</Description>
<Part Id="715515009423" Quantity="3" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="10">
<Description>The Killer</Description>
<Part Id="715515008976" Quantity="1" UnitPrice="39.95"/>
</LineItem>
<LineItem ItemNumber="11">
<Description>Ballad of a Soldier</Description>
<Part Id="37429167922" Quantity="2" UnitPrice="29.95"/>
</LineItem>
<LineItem ItemNumber="12">
<Description>Ordet</Description>
<Part Id="37429158623" Quantity="2" UnitPrice="0"/>
</LineItem>
</LineItems>
</PurchaseOrder>
SQL> begin
2 for x in (select object_value from PURCHASEORDER_XML) loop
3 x.object_value.schemaValidate();
4 end loop;
5 end;
6 /
PL/SQL procedure successfully completed.
SQL>
Maybe you are looking for
-
I am running a 6509 (IOS ver s3223-ipbasek9-mz.122-18.SXF3)with dual sup32's in SSO redundancy mode. I am also running Multiple Spanning-tree (MST). During testing I have found that when a switchover of the active supervisor occurs (due to physical r
-
Why is it that everytime i start up firefox it takes 4 to 5 times to try
every time i try to open up firefox it takes me 4 to 5 tries before it loads up what can u do to help?
-
SNDS and Slftware Deployment Manager
Hi, I just installed Sneak Preview SAP NetWeaver 2004 Slim Edition and tried to use the Netweaver Developer Studio (version 2.0.11). To get the Studio working I need to have SDM (Software Deployment Manager) should be installed as well. Can somebody
-
My daughters iPad uses my Apple ID and password but recently a friend used her id on my daughters iPad mini and now when trying to update certain apps or games it asks for the friends password I have tried deleting the apps and re installing them usi
-
ProRes HQ on a Mac G5 Quad?
I've been trying to work on a project in 10 bit uncompressed 1920 x 1080 HD and the data transfer speed is not allowing me to view my work realtime. I see 2 options - get a big (6 maybe 12 TB) RAID or move to ProRes HQ. My question - can I work in FC