Storing XML as CLOBs
Can anyone give me some input on how to
store XML files as CLOBs in an Oracle database, preferably using jdbc through jsp pages?
null
Hello Michael,
I believe the reference in the demo tutorial is to Insert process (not function). This is probably the process defined on page 8-6, step 4a of the "Create a process to insert information" section.
Basically you can upload and store files in CLOB. For my self, I only did it with XML files, but I don't see any reason not to do it with other types of files.
I think that in order to work with non-structured files (like ASCII) you should learn more about Oracle Text. Apex is also using this product. Search this forum for "oracle text" and continue from there.
Hope this helps,
Arie.
Similar Messages
-
Storing and searching XML in CLOBs
Speaking to an oracle employee at the Oracle booth at JavaOne
recently. They suggested I store XML in CLOBs
and use the DOM or SAX to reparse the XML later as needed.
I agreed that this was the best solution for my problem
(which was how to manage many different XML documents using many
different DTDs in a document management system)
The big problem was searching this document repository
to locate relevant information.
This is where Intermedia seemed ideal (still does).
It would be nice to see an example of setting this up using
Intermedia in Oracle 8i, demonstrating how to define the
XML_SECTION_GROUP and where to use a ZONE as opposed to a FIELD
etc.
Anybody care to take a shot at this ????
For example:
How would I define Intermedia parameters
so that I would be able to search my CLOB
column for records that had the <keyword>
"aorta" and "damage" in the <caption>
using the following
XML (DTD implied)
<image filename="OurImageName.gif">
<fname>WellKnownFileName.gif</fname>
<keyword>echocardiogram</keyword>
<keyword>aorta</keyword>
<caption>This is an image of the vessel damage</caption>
</image>
Thanks
Thomas Bennett
nullEric (guest) wrote:
: You can't do XML structure-based searches with intermedia. You
: can search for text within a given element, but nothing more
: complicated than that.
The example he gave involves exactly that -- searching for
text within XML elements. interMedia can do this.
: It also does not do attributes.
Upcoming 8.1.6 version allows searching within
attribute text. That's something like:
dog within book@author
We're working on attribute value sensitive search,
more like:
dog within book[@author = "Eric"]
: Thomas Bennett (guest) wrote:
: : How would I define Intermedia parameters
: : so that I would be able to search my CLOB
: : column for records that had the <keyword>
: : "aorta" and "damage" in the <caption>
: : using the following
: : XML (DTD implied)
: : <image filename="OurImageName.gif">
: : <fname>WellKnownFileName.gif</fname>
: : <keyword>echocardiogram</keyword>
: : <keyword>aorta</keyword>
: : <caption>This is an image of the vessel damage</caption>
: : </image>
begin
ctx_ddl.create_section_group('mygrp','basic_section_group');
ctx_ddl.add_field_section('mygrp','keyword','keyword');
ctx_ddl.add_field_section('mygrp','caption','caption');
end;
create index myidx on mytab(mytxtcolumn)
indextype is ctxsys.context
parameters ('section group mygrp');
select * from mytab
where contains(mytxtcolumn, 'aorta within keyword')>0;
options:
* use XML section group instead of basic section group
if your tags have attributes or you need case-sensitive
tag detection
* use zone sections instead of field sections if your
sections overlap, or if you need to distinguish
between instances. For instance, keywords. If keywords
is a field section, then
(aorta and echocardiogram) within keywords
finds the document. if it is a zone section, then it
doesn't, because they are not in the SAME instance of
keywords.
null -
I’m building some ETL process to extract data from XML in CLOB columns. I know that there are solutions to use functions as extractvalue() of WB_XML_LOAD(), but I want to know if there is any other way to deal with XML. The reason for that is because my XML files have multiple namespaces and nodes, and I need something more complex to deal with that, since I already tried those two first solutions.
My first solution was to create a PL/SQL that parses the XML and looks for tags and elements. It populates a relational table, and I might use OWB to extract the data from this table. But I’m dealing with a large table and it takes a while for processing, plus my code is hude!
My question is: Does someone have any experience with complex XML in Clob columns? If so, what was your solution for that?
Thanks a lot!
Angelo Buss
[email protected]CLOB is a fully-updateable, character large object that is stored inside the database. It can be text-indexed using interMedia for document searching.
BFILE is a readonly pointer to a file on the external file system whose content is not physically stored in the database. It can also be text-indexed for document searching, but it can't be updated. -
Could somebody tell me the different between save XML in CLOB and BFILE, addition to generic different between CLOB and BFILE, is there a performance issue?
ThanksCLOB is a fully-updateable, character large object that is stored inside the database. It can be text-indexed using interMedia for document searching.
BFILE is a readonly pointer to a file on the external file system whose content is not physically stored in the database. It can also be text-indexed for document searching, but it can't be updated. -
Single record view: xml in clob view formatted
I'm storing xml data in a clob. When I select 'single record view' I see my xml on a single line. I would like to see it formatted for easy reading. Is there a way to accomplish this?
Don't think so, works the same way in the grid; you have to press the Edit icon inside the cell to see proper line breaks.
You can always add this as feature request at the SQL Developer Exchange, so other users can vote to add weight for possible future implementation.
Regards,
K. -
Migrating V9 to V10: Update XML Fragment CLOB does not work anymore
I have an XML Schema that contains an element, named Operazione, mapped to a CLOB.
I just migrate to Oracle 10.1.0.2.0 from version 9.2.0.2.0 and the code I developed does not work anymore.
To get a CLOB on v 9.2.0.2.0 I issued the following statement:
select extractValue(value(p),'/operazione.log/Operazione') from XMT_OPERAZIONE_LOG p
where existsNode(value(p),'/operazione.log/Journal[NumeroElettronico=1234567890]') = 1
To make it working on V10 I have to change it as follow:
select extract(value(p),'/operazione.log/Operazione').getClobVal() from XMT_OPERAZIONE_LOG p
where existsNode(value(p),'/operazione.log/Journal[NumeroElettronico=1234567890]') = 1
So using extract intead of extractValue and adding getClobVal() I was able to read the CLOB.
The problem that I was not able to solve is related to CLOB update. In V9 just adding the âfor updateâ clause I was able to change the CLOB value on DB.
In V10 if I run the V9 statement I get the error:
ORA-03113: end-of-file on communication channel
If I use the statement modified for V10, adding the âfor updateâ clause, I get the CLOB and I can change the CLOB value but nothing goes on the DB. Probably I am working on a copy of the DB CLOB.
If I remove the getClobVal() I get an OPAQUE type that I can use on a XMLType but, still, nothing is stored on DB.
Any suggestion ?
I tried with both OCI and Thin ClientCan anybody help me ?
Is it better to use different strategies ( eg. Stored Procedure, DBMS_XMLSTORE etc, etc. ) ?
Any experience updatating XML Fragment CLOB on Oracle V10 ? -
Currently we have a web application that stores all of it's associated data in an XML document. This XML document is then stored in a CLOB field in an Oracle 10g database. I would like to use XML Publisher to query the XML document that is stored in the CLOB field. I have installed XML Publisher and cannot find a way get an XML feed from a CLOB field on a database. Please advise if this is possible and if so, some pointers as to how this can be accomplished. Thank you.
Apologies, I thought I had written this up for the blog ... evidently not:
select WAREHOUSES.WAREHOUSE_ID as WAREHOUSE_ID,
substr(WAREHOUSES.WAREHOUSE_SPEC.getClobval(),22) as WAREHOUSE_SPEC,
WAREHOUSES.WAREHOUSE_NAME as WAREHOUSE_NAME
from OE.WAREHOUSES WAREHOUSES
Where WAREHOUSE_SPEC contains :
<?xml version="1.0" ?>
<Warehouse>
<Building>Owned</Building>
<Area>25000</Area>
<Docks>2</Docks>
<DockType>Rear load</DockType>
<WaterAccess>Y</WaterAccess>
<RailAccess>N</RailAccess>
<Parking>Street</Parking>
<VClearance>10 ft</VClearance>
</Warehouse>
I needed the substr to strip the header out, not elegant but it works just fine.
Tim -
Using XSU for Storing XML data
Please how can I use the XSU API for storing XML documents in Oracle8i? I know part of the code to store a document but how do I import the XSU API?
Do I have to download it or use it via Oracle?
example:
String xmlDoc = "my_xml_document";
Connection conn = >>DriverManager.getConnection(...);
OracleXMLSave sav = new OracleXMLSave
(conn,"purchaseOrderTab");
sav.insertXML(xmlDoc);But how do I use OracleXMLSave? How do I import the XSU API?
thanks for your help
nullWhat is XSU? I think you question should be posted at the XML or XDK forum.
-
Extract part of xml into CLOB or XMLType
I need to extract part of XML into CLOB or some another type. But I don't need only extract data, by whole part od xml with elements. How could I do it in PL/SQL?
For example from this xml:
<bookstore>
<book category="COOKING">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
<book category="CHILDREN">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
</bookstore>
I need to get:
"<book category="COOKING">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>"
THXThat's why I need to process every book alone - to know which authors belongs to single book.For that specific requirement, a single query would do.
Assuming variable "v_xml_clob" holds the XML document :
<bookstore>
<name>nameOfBookstore</name>
<address>1st Avenue 24, SF</address>
<book category="COOKING">
<title lang="en">Everyday Italian</title>
<author>
<name>Giada De Laurentiis</name>
<birth>1956</birth>
</author>
<author>
<name>xxx</name>
<birth>1955</birth>
</author>
<year>2005</year>
<price>30.00</price>
</book>
<book category="CHILDREN">
<title lang="en">Harry Potter</title>
<author>
<name>Rowning</name>
<birth>1977</birth>
</author>
<author>
<name>xxx</name>
<birth>1955</birth>
</author>
<year>2005</year>
<price>29.99</price>
</book>
</bookstore>You can do :
SELECT *
FROM XMLTable(
'for $i in distinct-values($d//book/author/name)
where count($d//book/author[name=$i]) = 1
return $i'
passing xmltype(v_xml_clob) as "d"
columns author_name varchar2(80) path '.'
AUTHOR_NAME
Rowning
Giada De Laurentiis -
Hi, there. Here's my question for XML gurus. What I need to do and I am currently evaluating a number of products to find ones that best fit my needs:
1) store XML documents as they come, in their XML form in some sort of XML repository.
2) Be able to run various queries against that XML repository. For example, if there exist a bunch of documents of DOCTYPE "blah" (among others) I need to query the repository like: for all documents of this doctype select docs that have a value of a tag <PurchaseOrder> between 11-01-2000 and 11-14-2000.
In other words, I'd like to operate just on XML, and nothing else. Store XML and query the repository to get XML back.
Is Oracle's XML products capable of doing something like that ? If so, which ones would I need to utilize to obtain the results. And if not, could anyone point me towards the products that are capable of doing what I need ?
Any help and feedback would be greatly appreciated.
Thank you.<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Dmitriy:
Thank you for your prompt reply. 'Dynamic news' app looks great, but it's not exactly what I need. The emphasis is on storing XML messages as they are, not broken up into relational representation, AND being able to query those messages on the values of the different tags contained in those XML docs.
Can Oracle do that ?<HR></BLOCKQUOTE>
Oracle interMedia could be help you in this problem, go to the interMedia section on this web site and look at in the examples and the documentation.
Best regards, Marcelo.
null -
How can I parse XML from CLOB field? I need to replace or delete the node from XML document and update the database with new XML. I am using Oracle 9i release 2.
Here is the XML. In this XML if section1 and section2 exists then I need to delete the section1 node. If section2 doesn't exist, replace section1 with section2 node.
<Document ID='2' TypeID='2'>
<Body>
<Page Name='Page1'>
<Sec ID='section1' Title='Section 1' GroupID='' />
<Sec ID='section2' Title='Section 2' GroupID='' />
</Page>
</Body>
</Document>
Please help.. Thank you..In 9.2, you are limited into your options. Have a look into, among others, updateXML. Updating tp 10gR2 will give you more options to succeed.
-
How can I query data from XML file stored as a CLOB ?
Hi folks,
please see below sample of XML file, which is stored in "os_import_docs", column "document" as CLOB.
I would like to query this XML file using some SQL select.
How can I query data form below XML?
<?xml version="1.0" encoding="UTF-8"?>
<etd>
<header>
<AR>000000000</AR>
<AW>0</AW>
<CT>S</CT>
<CU>H</CU>
<CZ>SS48</CZ>
<BU>4</BU>
<CH>0032</CH>
<CK>2012-11-01</CK>
<CL>21:18</CL>
<CW>225</CW>
<CX>0</CX>
<CF>SS-CZL18</CF>
<DV>2</DV>
</header>
<account_group id="234">
<account id="234">
<invoice id="000742024">
<da>
<AR>000742024</AR>
<AW>0</AW>
<CT>D</CT>
<CU>A</CU>
<CH>0032</CH>
<BY>31-10-2012</BY>
<CA>25-10-2012</CA>
<AB>234</AB>
<AA>234</AA>
<BS>88754515</BS>
<AD>Mike Tyson</AD>
<AC>Mike Tyson</AC>
<AZ>CZ6521232465</AZ>
<AE/>
<CG>A</CG>
<AL>A</AL>
<BZ>.</BZ>
<AH>Some street</AH>
<AI/>
<AF>Some city</AF>
<AK>Kraj</AK>
<AG>CZ</AG>
<AJ>885 21</AJ>
<CR>21-11-2012</CR>
<AY>602718709</AY>
<AV>800184965</AV>
<AP/>
<AO/>
<AQ/>
<AN/>
</da>
<da>
<AR>000742024</AR>
<AW>0</AW>
<CT>D</CT>
<CU>A</CU>
<CH>0032</CH>
<BY>31-10-2012</BY>
<CA>25-10-2012</CA>
<AB>234</AB>
<AA>234</AA>
<BS>88754515</BS>
<AD>Mike Tyson</AD>
<AC>Mike Tyson</AC>
<AZ>CZ6521232465</AZ>
<AE/>
<CG>A</CG>
<AL>L</AL>
<BZ>Mike Tyson</BZ>
<AH>Some street</AH>
<AI/>
<AF>Some city</AF>
<AK>Kraj</AK>
<AG>CZ</AG>
<AJ>885 21</AJ>
<CR>21-11-2012</CR>
<AY/>
<AV>800184965</AV>
<AP/>
<AO/>
<AQ/>
<AN/>
</da>
<detaildc CH="0032" AB="234" BS="11888954" BB="32" BA="CZ" AT="" CI="7077329000002340342" AU="" DU="1Z48395" CB="CZK">
<dc>
<AW>0</AW>
<CT>D</CT>
<CU>C</CU>
<BY>31-10-2012</BY>
<CA>25-10-2012</CA>
<CV>8151</CV>
<BT>12111</BT>
<CJ>1</CJ>
<AM>0</AM>
<DR>PC</DR>
<DS/>
<DO>25-10-2012</DO>
<DQ>18:42</DQ>
<CE>1</CE>
<BH>8151</BH>
<CY>8151 SHELL MALKOVICE P</CY>
<DP>049336</DP>
<DT/>
<BQ/>
<BR>500000</BR>
<CN>30</CN>
<CM>030</CM>
<BO>160,00</BO>
<BF>38,900</BF>
<BC>6224,00</BC>
<BI>32,417</BI>
<CD>B</CD>
<BG>0,600</BG>
<BK>31,817</BK>
<BJ>0,000</BJ>
<DI>8</DI>
<BP>20,00%</BP>
<CC>CZK</CC>
<BM>5090,67</BM>
<BN>1018,13</BN>
<BL>6108,80</BL>
<BD>5090,67</BD>
<BE>1018,13</BE>
<DW>6108,80</DW>
<CO>Nafta</CO>
</dc>
</detaildc>
<dt>
<AR>000742024</AR>
<AW>0</AW>
<CT>D</CT>
<CU>T</CU>
<CH>0032</CH>
<BY>31-10-2012</BY>
<CA>25-10-2012</CA>
<AB>234</AB>
<AA>234</AA>
<BS>11888954</BS>
<BB/>
<BA>CZ</BA>
<DG>1</DG>
<CN>30</CN>
<CM>030</CM>
<DF>160,00</DF>
<DH>litr</DH>
<DJ>20,00%</DJ>
<DD>5090,67</DD>
<DE>1018,13</DE>
<DC>6108,80</DC>
<DB>CZK</DB>
<DA>P</DA>
<AX/>
<CQ/>
<CP/>
</dt>
<dt>
<AR>000742024</AR>
<AW>0</AW>
<CT>D</CT>
<CU>T</CU>
<CH>0032</CH>
<BY>31-10-2012</BY>
<CA>25-10-2012</CA>
<AB>234</AB>
<AA>234</AA>
<BS>11888954</BS>
<BB/>
<BA>CZ</BA>
<DG>2</DG>
<CN/>
<CM/>
<DF>160,00</DF>
<DH>litr</DH>
<DJ/>
<DD>5090,67</DD>
<DE>1018,13</DE>
<DC>6108,80</DC>
<DB>CZK</DB>
<DA/>
<AX/>
<CQ/>
<CP/>
</dt>
<dt>
<AR>000742024</AR>
<AW>0</AW>
<CT>D</CT>
<CU>T</CU>
<CH>0032</CH>
<BY>31-10-2012</BY>
<CA>25-10-2012</CA>
<AB>234</AB>
<AA>234</AA>
<BS>11888954</BS>
<BB/>
<BA>CZ</BA>
<DG>19</DG>
<CN/>
<CM/>
<DF/>
<DH/>
<DJ/>
<DD>5090,67</DD>
<DE>1018,13</DE>
<DC>6108,80</DC>
<DB>CZK</DB>
<DA/>
<AX/>
<CQ/>
<CP/>
</dt>
<dt>
<AR>000742024</AR>
<AW>0</AW>
<CT>D</CT>
<CU>T</CU>
<CH>0032</CH>
<BY>31-10-2012</BY>
<CA>25-10-2012</CA>
<AB>234</AB>
<AA>234</AA>
<BS>11888954</BS>
<BB/>
<BA>CZ</BA>
<DG>8</DG>
<CN/>
<CM/>
<DF/>
<DH/>
<DJ/>
<DD>5090,67</DD>
<DE>1018,13</DE>
<DC>6108,80</DC>
<DB>CZK</DB>
<DA/>
<AX/>
<CQ/>
<CP/>
</dt>
</invoice>
</account>
</account_group>
<footer>
<AR>999999999</AR>
<AW>0</AW>
<CT>S</CT>
<CU>T</CU>
<CZ>SS48</CZ>
<BU>4</BU>
<CH>0032</CH>
<CK>2012-11-01</CK>
<CL>23:04</CL>
<CW>225</CW>
<BX>1</BX>
<CS>7</CS>
<BW>0000000000000610880</BW>
</footer>
</etd>sample - not working:
select x.*
from os_import_docs d
,XMLTABLE('/etd/header'
PASSING httpuritype(d.document).getXML()
COLUMNS
response_status varchar2(50) PATH 'AR'
) x
where d.object_id = 2587058
and rownum = 1;
ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 6196, maximum: 4000)Many thanks,
TomasHello,
many thanks for the reply. Your examples are very usefull for me.
To answer your questions.
An XML structure:
/etd
/header - repeat in each row in output
/account_group/account
/invoice
/da - repeat for each details under "selected "invoice
/detaildc/dc - the lowest level
/detaildn/dn - the lowest level
/dt - repeat for each details under "selected "invoice
/footer - repeat in each row in outputI would like to to have a 1 row for each "record" in /detaildc section and include related nodes at higher levels.
Please see below XML file, which is simplified file of example in first post, but includes a complete xml structure which needs to be queried in db.
<?xml version="1.0" encoding="UTF-8"?>
<etd>
<header>
<AR>000000000</AR>
<CK>2012-10-31</CK>
<CF>SS-CZL19</CF>
</header>
<account_group id="234">
<account id="234">
<invoice id="EI08P4000">
<da>
<AR>EI08P4000</AR>
<AD>Mickey Mouse</AD>
</da>
<detaildc DU="1Z56655" CB="EUR">
<dc>
<DO>16-10-2012</DO>
<CY>ASFINAG POST_MAUT</CY>
<BM>1940,60</BM>
<CO>Dalnicni znamka</CO>
</dc>
</detaildc>
<detaildc DU="2Z55050" CB="EUR">
<dc>
<DO>17-10-2012</DO>
<CY>ASFINAG POST_MAUT</CY>
<BM>1328,10</BM>
<CO>Dalnicni znamka</CO>
</dc>
</detaildc>
<detaildc DU="2Z90001" CB="EUR">
<dc>
<DO>27-10-2012</DO>
<CY>ASFINAG POST_MAUT</CY>
<BM>185,10</BM>
<CO>Poplatek</CO>
</dc>
</detaildc>
<dt>
<AR>EI08P4000</AR>
<DG>8</DG>
</dt>
</invoice>
</account>
<account id="234">
<invoice id="EI13T7777">
<da>
<AR>EI13T7777</AR>
<AD>Mickey Mouse</AD>
</da>
<detaildc DU="1Z48302" CB="EUR">
<dc>
<DO>26-10-2012</DO>
<CY>SANEF 07706 A 07704</CY>
<BM>232,10</BM>
<CO>Dalnicni poplatek</CO>
</dc>
</detaildc>
<detaildc DU="1Z48302" CB="EUR">
<dc>
<DO>20-10-2012</DO>
<CY>TEST A 07704</CY>
<BM>30,10</BM>
<CO>Poplatek</CO>
</dc>
</detaildc>
<dt>
<AR>EI13T7777</AR>
<DG>8</DG>
</dt>
</invoice>
</account>
<account id="234">
<invoice id="EI327744">
<da>
<AR>EI327744</AR>
<AD>Mickey Mouse</AD>
</da>
<detaildn CI="707732 00000234" >
<dn>
<BY>30-10-2012</BY>
<BM>8,10</BM>
</dn>
</detaildn>
<detaildn CI="707732 00000234" >
<dn>
<BY>30-10-2012</BY>
<BM>399,50</BM>
</dn>
</detaildn>
<dt>
<AR>EI327744</AR>
</dt>
</invoice>
</account>
<account id="234">
<invoice id="EI349515">
<da>
<AR>EI349515</AR>
<AD>Mickey Mouse</AD>
</da>
<detaildc DU="1Z56514" CB="EUR">
<dc>
<DO>29-10-2012</DO>
<CY>ALLAMI AUTOPALYAKEZE</CY>
<BM>1240,60</BM>
<CO>Dalnicni znamka</CO>
</dc>
</detaildc>
<detaildc DU="1Z56515" CB="EUR">
<dc>
<DO>19-10-2012</DO>
<CY>ASFINAG POST_MAUT</CY>
<BM>7428,10</BM>
<CO>Dalnicni znamka</CO>
</dc>
</detaildc>
<detaildc DU="1Z56515" CB="EUR">
<dc>
<DO>12-10-2012</DO>
<CY>UK</CY>
<BM>954,10</BM>
<CO>Poplatek</CO>
</dc>
</detaildc>
<dt>
<AR>EI349515</AR>
<DG>8</DG>
</dt>
</invoice>
</account>
</account_group>
<footer>
<CZ>SS47</CZ>
<BU>4</BU>
<CH>0032</CH>
<CK>2012-10-31</CK>
<CL>01:25</CL>
</footer>
</etd>Expected output
AR CK CF AR4 AD DU CB DO CY BM CO AR5 DG CI BY BM6 CZ BU CH CK7 CL
0 41213 SS-CZL19 EI08P4000 Mickey Mouse 1Z56655 EUR 16-10-2012 ASFINAG POST_MAUT 1940,60 Dalnicni znamka EI08P4000 8 SS47 4 32 41213 01:25
0 41213 SS-CZL19 EI08P4000 Mickey Mouse 2Z55050 EUR 17-10-2012 ASFINAG POST_MAUT 1328,10 Dalnicni znamka EI08P4000 8 SS47 4 32 41213 01:25
0 41213 SS-CZL19 EI08P4000 Mickey Mouse 2Z90001 EUR 27-10-2012 ASFINAG POST_MAUT 185,10 Poplatek EI08P4000 8 SS47 4 32 41213 01:25
0 41213 SS-CZL19 EI13T7777 Mickey Mouse 1Z48302 EUR 26-10-2012 SANEF 07706 A 07704 232,10 Dalnicni poplatek EI13T7777 8 SS47 4 32 41213 01:25
0 41213 SS-CZL19 EI13T7777 Mickey Mouse 1Z48302 EUR 20-10-2012 TEST A 07704 30,10 Poplatek EI13T7777 8 SS47 4 32 41213 01:25
0 41213 SS-CZL19 EI327744 Mickey Mouse EI327744 707732 00000234 30-10-2012 8,10 SS47 4 32 41213 01:25
0 41213 SS-CZL19 EI327744 Mickey Mouse EI327744 707732 00000234 30-10-2012 399,50 SS47 4 32 41213 01:25
0 41213 SS-CZL19 EI349515 Mickey Mouse 1Z56514 EUR 29-10-2012 ALLAMI AUTOPALYAKEZE 1240,60 Dalnicni znamka EI349515 8 SS47 4 32 41213 01:25
0 41213 SS-CZL19 EI349515 Mickey Mouse 1Z56515 EUR 19-10-2012 ASFINAG POST_MAUT 7428,10 Dalnicni znamka EI349515 8 SS47 4 32 41213 01:25
0 41213 SS-CZL19 EI349515 Mickey Mouse 1Z56515 EUR 12-10-2012 UK 954,10 Poplatek EI349515 8 SS47 4 32 41213 01:25 -
Modifying XML Stored in a CLOB
I've got XML documents stored in a column using the CLOB datatype on a 10gR2 database.
We once tried to use the XML type, but there was a 64k size limit I think (can't recall the specifics, maybe that limitation has since been fixed). Do you happen to know?
My problem is that now I need to write a script to modify the format of the date found between the <date-created> </date-created> XML tags within each CLOB.
For example <date-created>2007-01-01 00:00:00</date-created> would become <date-created>01-01-2007 00:00:00</date-created>.
I can certainly figure out how to parse the XML and do an UPDATE to each row through a PL/SQL script, but before I go down that road I thought I'd ask if there are any tools that might make this task easier for me? I have thousands of entries that need modified, so it must be an automated process.
For example, maybe there are some PL/SQL procedures for manipulating CLOB data?
I figure it doesn't hurt to ask before I start this task if there's an easy way to go about this or if anyone else has had a similar problem to solve and could share the code they used.
Thank youit's YYYY-MM-DD and other rows (the newer ones) have the format MM-DD-YYYYOk, i thought you're changing the date format for all the rows and hence i was wondering if looping through each row is required or not. Anyway, i still think you can filter out all the rows with the older format, and just use a single update statement to update the xml node values for those.
hr@XE> create table myxml(id number, xmlcol xmltype);
Table created.
hr@XE> insert into myxml values(1, '<root> <date1> 01-04-2007 </date1> </root>');
1 row created.
hr@XE> insert into myxml values(2, '<root> <date1> 11-04-2007 </date1> </root>');
1 row created.
hr@XE> update myxml
set xmlcol = updatexml(xmlcol,'/root/date1/text()',
to_char(to_date(extractvalue(xmlcol,'/root/date1'),'DD-MM-YYYY'),'mm/dd/yyyy') );
2 row updated.
hr@XE> select id, xmlcol from myxml;
ID
XMLCOL
1
<root>
<date1>04/01/2007</date1>
</root>
2
<root>
<date1>04/11/2007</date1>
</root> -
Storing XML data in CLOB and relational tables
I would like to ask whether there is a possibility to store XML data using normal relational tables and CLOBs in the same time. For example I have some XML data (structured data) which I would like update very often and some which are only a kind of description. I found something about it in http://technet.oracle.com/tech/xml/infoocs/otnwp/about_oracle_xml_products.htm . But I do not know how to use Oracle8i views and some functionality of XML SQL Utility to retrieve XML data in one file.
null<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Maciej Marczukajtis ([email protected]):
I would like to ask whether there is a possibility to store XML data using normal relational tables and CLOBs in the same time. For example I have some XML data (structured data) which I would like update very often and some which are only a kind of description. I found something about it in http://technet.oracle.com/tech/xml/infoocs/otnwp/about_oracle_xml_products.htm . But I do not know how to use Oracle8i views and some functionality of XML SQL Utility to retrieve XML data in one file.<HR></BLOCKQUOTE>
Czesc Maciek,
There are some good examples with XSQL Servlet. From what I understand you have one XML file and you need to save a portion of document in relational tables and other portion in CLOB.
Yes, you can do that.
You can do it many ways. I can suggest (2).
1. Use the views
2. call your java procedure that will do
the xml processing, brake it down and insert
releval frogments into different tables/columns
null -
How to query XML data stored in a CLOB column
I don't know XMLDB, so I have a dumb question about querying XML data which is saved as CLOB in a table.
I have a table (OLAP_AW_PRC), with a CLOB column - AW_XML_TMPL_VAL
This column contains this xml data - [click here|http://www.nasar.net/aw.xml]
Now I want to query the data using the xml tags - like returning the name of AW. This is where I am having trouble, how to query the data from AW_XML_TMPL_VAL clob column.
The following query generates error:
ORA-31011: XML parsing failed.
ORA-19202: Error occurred in XML processing
LPX-00229: input source is empty
SELECT
extractValue(value(x), '/AW/LongName') as "AWNAME"
from
OLAP_AW_PRC,
table(xmlsequence(extract (xmltype(AW_XML_TMPL_VAL), '/AWXML/AWXML.content/Create/ActiveObject/AW'))) x
where
extractValue(value(x) , '/AW/Name') = 'OMCR4'
- NasarMark,
Thanks. This is exactly what I was looking for.
After doing @Name in both places (SELECT and WHERE clause) it worked.
Now I have one more question.
There are multiple DIMENSION tags in my xml, and I want to see the NAME attribute values for all of those DIMENSIONs. The following query returns
ORA-19025: EXTRACTVALUE returns value of only one node.
Cause: Given XPath points to more than one node.
Action: Rewrite the query so that exactly one node is returned.
SELECT
extractValue(value(x), '/AW/@Name') as "AW",
extractValue(value(x), '/AW/Dimension/@Name') as "DIMENSIONS"
from
OLAP_AW_PRC,
table(xmlsequence(extract (xmltype(AW_XML_TMPL_VAL), '/AWXML/AWXML.content/Create/ActiveObject/AW'))) x
where
extractValue(value(x) , '/AW/@Name') = 'OMCR4'
Maybe you are looking for
-
Can't get 3G Mobile Hotspot to work with Cr-48
I can't get my Google Cr-48 (the free Google computer) to connect to my 3G Mobile Hotspot. It sees the phone, associates with it, but it won't connect--I get an error message every time. I know the hotspot works with other computers, both laptop and
-
My Ipad is delete key is stuck
my ipad seems like the delete key is stuck. When every try to type any text, it just deletes it. The cursor keeps on blinking. If I reposition the cursor further down in an existing document, then it starts deleting the document from there backward
-
Creating a GREP style Help Needed
I would like to set-up a style using GREP expression(s) that would do the following: Everything preceding an em dash (including the em dash and two spaces after the em dash) would be set to bold-italic, AND everything in the paragraph that begins wit
-
Whats the difference when i start an ABAP code in the CMOD, in the User exit variable like this: - IF I_STEP = 2 - IF I_STEP = 1 please explain me, i ll really appreciate it, thanks !
-
Hi Please Help. I'm getting ( run-time error '13'; type mismatch) when I'm trying to login to BI Publisher thru Oracle BI Publisher Log on in MS Word. Thanks Ribhi