Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Development Trends in Web and Oracle
"IANAL_VISTA" <IANAL_Vista_at_hotmail.com> wrote in message
news:Xns9617425B13F65SunnySD_at_68.6.19.6...
> Because one can not easily & efficiently search for data stored within
> XML.
Oh yes you can. Remember XMLTYPEs are stored and processed under the bonnet
on a par with other native Oracle datatypes. The data is stored
relationally using with little performance impact if appropriately indexed.
The most important message to get across is that this is neither an
inefficient addin nor is the XML being searched with LIKE %whatever% or
doing full table scans (unless you have implemented it incorrectly and here
the argument stands equally for the relational model too). The XML is
shredded upon insert and stored relationally; the required XML is
reconstituted upon SELECT.
The select statement below is how easy it can be to select data. The
searching can be as easy as the XPATH expression.
Regards
Hex
Eg (don't have access to db at the moment but it really is as trivial as below). Search out more examples with Google or in the Oracle docs. Hex
CREATE TABLE tableName
(
whateverXML XMLTYPE
)
XMLTYPE whateverXML STORE AS OBJECT RELATIONAL
XMLSCHEMA "http://www.whoever.com/whatever.xsd"
ELEMENT "whateverRoot";
--and create indexes, triggers, etc as before. The example below shows
primary key
ALTER TABLE tbleName ADD (PRIMARY KEY(XMLDATA."whateverPK"));
-- --And to query the database, for example. Here only the rows where the database --version number = 10g. Because of the xpath expression, it obviates the need --for a WHERE clause (although generally it is still used for other reasons)., SELECT EXTRACT(x.whateverXML,'whateverRoot/Databases/Oracle[version="10g"].text()') FROM tableName t; "IANAL_VISTA" <IANAL_Vista_at_hotmail.com> wrote in message news:Xns9617425B13F65SunnySD_at_68.6.19.6...Received on Sat Mar 12 2005 - 09:23:25 CST
> "Hexathioorthooxalate" <ruler_at_removemetoemail.clara.co.uk> wrote in
> news:1110636493.21027.0_at_ersa.uk.clara.net:
>> >> So I ask again, what is the real reason for not storing XML in a >> database then? >> Hex >> >
> Because one can not easily & efficiently search for data stored within
> XML.