/* * 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 4 1999-09-12 20:11:29Z 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, CONSTRAINT document_pk PRIMARY KEY (docid), CONSTRAINT fk_root_node FOREIGN KEY (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, CONSTRAINT elements_pk PRIMARY KEY (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, CONSTRAINT KEY (attributeid), CONSTRAINT fk_parent_node FOREIGN KEY (nodeid) REFERENCES elements );