Oracle9i XML Sample:
Metadata Sample with the Oracle9i Metadata API

January 2004

The Oracle9i Metadata API is embodied within the DBMS_METADATA PL/SQL package. It provides a simple, centralized way to view and extract the complete definitions of all database objects. Both XML and SQL DDL formats are supported by default. User-written transforms may be applied to the XML to produce other formats such as HTML as the sample application will show. The Metadata API supports two styles of interfaces: A casual browsing mode using the GET_XML and GET_DDL functions, and a programmatic interface using an 'open context / set filters / fetch / close' paradigm that enables detailed control over the selection of objects and output format. The Metadata API is available in all operational Oracle9i database instances.

The sample application demonstrates many of the Metadata API's capabilities. A sample schema is established with tables, indexes, triggers, grants and views. The Metadata API is used to extract all of these objects' metadata as XML, DDL and HTML. The application also provides an option to modify certain table characteristics then view the resultant metadata. You can view the PL/SQL source code for each operation as well as the XSL-T source for those operations performing transformations.

This sample demonstrates the following using the Oracle9i Metadata API:

  • Extracting the complete definitions of database objects metadata as either XML, SQL DDL or HTML
  • Transforming the metadata via industry standard XSLT
  • Daisy chained transforms where the output of the first becomes the input to the second and so on by the usage of multiple calls to ADD_TRANSFORM procedure available in the Metadata API
  • SQL DDL output customized via object type-specific transform parameters

The live online demo is a running application that shows how the metadata can be retrieved on the different database objects in different formats like XML, SQL DDL and HTML.

Prerequisite:

  • Oracle9i Database
  • Oracle9iAS Containers for J2EE(OC4J) Release 2.0

Notes:

  • Demo with require XML browsing capabilities of Internet Explorer 5.0.
Run the Demonstration

The demonstration is online at:

Developers can follow the demo by running the application and reviewing the source code of the demo application.

Download the Sample

The download includes installation instructions, PL/SQL source code, Java source code and SQL scripts for building the database.

Related Documents

E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy