Oracle Database xml Data Types

Source: Internet
Author: User
Oracle XML implementation? Oracle has implemented XML through the XMLDB component, which is a standard feature of the Enterprise Edition and Standard Edition. You can easily install OracleXMLDB by using the database configuration Assistant (DBCA) or running a directory script catqm. SQL. The XMLDB product provides all the features discussed in this article. To verify whether XMLDB is installed, run the following SQL: comp_namefrom

Oracle XML implementation?
Oracle has implemented XML through the xml db component, which is a standard feature of the Enterprise Edition and Standard Edition. You can easily install Oracle xml db by using the database configuration Assistant (DBCA) or running a directory script catqm. SQL. The xml db product provides all the features discussed in this article.

To verify whether xml db is installed, run the following SQL:

Comp_name from dba_registry where comp_name like ''% XML %''; COMP_NAME Oracle XML Database can also view the xml db Mode and Its objects to check whether Oracle xml db is installed.

SQL and XML collaboration
The SQL/XML standard is under development to provide a mechanism that allows us to generate XML from link queries, and vice versa, enables us to submit SQL data from XML documents. Oracle xml db in Oracle Database 10g 2nd implements SQL 2003 and comes from the upcoming SQL/XML standard edition features. The implementation of these standards in Oracle enables us to view XML documents in a way that was not possible in the previous SQL standards.

New data type. A new data type XMLType is introduced in Oracle9i Database 1st, which allows SQL to access XML documents in the database and allows XML developers to use XML standards in documents. This data type notifies the database that the content is in XML format and allows us to perform queries on the XML document. XMLType (instead of a relational or CLOB implementation) provides a separation layer between the application and the storage model. This separation allows data to be moved to a different storage model, not limited to CLOB or relational model. XMLType can be used to create tables, columns, or views. It can also be used as the data type of parameters and variables.

The built-in XML method can process document content, allowing us to create, extract, and index XML data. Indexes can be executed using B-tree, text indexes, and function-based indexes. In fact, XMLType data combined with XPath can be used to view documents. This function is provided through PL/SQL and Java APIs. XMLType can be used in PL/SQL, Java using JDBC, and Oracle Data Provider for. Net. This powerful and relatively new data type will be widely used in this article.

Storage Structure. Oracle's XML implementation provides us with the flexibility to store data in two different ways: Structured Storage and unstructured storage. XMLType data is unstructured when stored as a single LOB column and structured when implemented as an object set.

A specific example is the XMLType table, which can be implemented using one of the two storage models. The XMLType table is unstructured when the "XMLType store as CLOB" syntax is implemented as LOB as follows:
Create table table_name of XMLtypeXMLType store as CLOB;


Public static boolean insertLayerMetadata (DataSource ds, String xml, String id) throws SQLException, ClassNotFoundException {
Boolean flag = false;
String metadataTableName = DBUtil. getLayerMetadataTableName (ds );
StringBuffer SQL = new StringBuffer ("INSERT ");
SQL. append (metadataTableName). append ("(RECORDID, DATACOL) values (?, ?) ");
Try {
Connection con = DBUtil. getConnection (ds );
Logger.info ("excute SQL:" + SQL. toString ());
PreparedStatement prest = con. prepareStatement (SQL. toString ());
XMLType poXML = XMLType. createXML (con, xml );
Prest. setString (1, id );
Prest. setObject (2, poXML );
Prest.exe cute ();
Flag = true;
}
(SQLException e ){
Flag = false;
Logger.info (e );
Throw new SQLException (e );
} Catch (ClassNotFoundException e ){
Flag = false;
Logger.info (e );
Throw new ClassNotFoundException (e. getMessage ());
}
Return flag;
};

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.