Storing XML documents in Oracle
Question: Oracle is offering more than one possibility to save XML into its DB. Can you explain the different ways that you can store an XML document in Oracle?
Answer: Oracle has several procedures and techniques for inserting data, either in-line (inside the tablespace) or offline using the BFILE syntax.
Answer: Oracle has several procedures and techniques for inserting data, either in-line (inside the tablespace) or offline using the BFILE syntax.
Begin
DBMS_XMLSCHEMA.registerSchema(
schemaURL => 'Mailpiece_Processing/oif_dtypes',
schemaDoc => bfilename('XML_TEST','oif_dtypes.xsd'));
End;
Create table XML_default auf XMLType
insert into xml_default
values
(
XMLTYPE
(
Bfilename ('XML_TEST', 'Test.xml'),
nls_charset_id('AL32UTF8'
));
Also, note that the best benefit of XML-DB is the ability to validate document structure with DTD's, which Oracle has re-named XSD's (XML-DB schema definition):
Rampant author V. J. Jain has a good article on storing XML inside Oracle with XSD definitions.
Question: If I import XML with the BFILE option, is it called CLOB Storage or object relational?
Answer: I would say "both"! The main difference between relational and object-relational is the use of pointers (file location address), so the BFILE function is indeed object-oriented. It's also properly called CLOB storage, but remember that CLOB's can also be stored in the tablespace without pointers.
Using the BFILE construct is outside Oracle, and all Oracles does is maintain a "pointer" to the file location where the CLOB resides. Oracle DOES not manage the data itself, in a traditional relational sense.
So, does this non-relational storage make it "object relational"? I would say "Yes".
In a true object-oriented database, the DBMS is nothing more that a persistence method for allowing object permanence. It's more like a C++ language extension than a DBMS.
What is "object oriented Oracle"? It's the incorporation of the OO constructs such as polymorphism, encapsulation and inheritance, but it also include the "create type" ability where you can define non-traditional storage constructs (nested tables, VARRAY columns, capturing OID's that point to rows).
No comments:
Post a Comment