/* * xmltables.sql -- Create or replace tables for storing XML in the db * * Purpose: creates tables needed for XML database * * Created: 12 September 1999 * Author: Matt Jones * Organization: National Center for Ecological Analysis and Synthesis * Version: '$Id: xmltables.sql 3 1999-09-12 20:07:05Z jones $' * */ /* * Documents -- table to store XML document catalog */ DROP TABLE documents; CREATE TABLE documents ( docid NUMBER(20), rootnodeid NUMBER(20), docname VARCHAR2(1000), doctype VARCHAR2(1000), date_created DATE, date_updated DATE, PRIMARY KEY document_pk (docid), FOREIGN KEY fk_root_node (rootnodeid) REFERENCES elements ); /* * Elements -- table to store XML Elements */ DROP TABLE elements; CREATE TABLE elements ( nodeid NUMBER(20), nodename VARCHAR2(2000), nodedata VARCHAR2(2000), date_created DATE, date_updated DATE, PRIMARY KEY elements_pk (nodeid) ); /* * Attributes -- table to store XML Attributes */ DROP TABLE attributes; CREATE TABLE attributes ( attributeid NUMBER(20), nodeid NUMBER(20), attributenumber NUMBER(20), attributename VARCHAR2(2000), attributevalue VARCHAR2(2000), date_created DATE, date_updated DATE, PRIMARY KEY attributes_pk (attributeid), FOREIGN KEY fk_parent_node (nodeid) REFERENCES elements );