diff flys-backend/doc/schema/oracle-spatial.sql @ 5291:66d9389c80cb

added tables for jetties in spatial schema
author Tom Gottfried <tom@intevation.de>
date Thu, 14 Mar 2013 12:16:58 +0100
parents 170f514a4f29
children aa407dfb9949
line wrap: on
line diff
--- a/flys-backend/doc/schema/oracle-spatial.sql	Thu Mar 14 11:56:13 2013 +0100
+++ b/flys-backend/doc/schema/oracle-spatial.sql	Thu Mar 14 12:16:58 2013 +0100
@@ -373,3 +373,30 @@
         SELECT GAUGE_LOCATION_ID_SEQ.nextval INTO :new.id FROM dual;
     END;
 /
+
+
+CREATE TABLE jetty_kinds(
+    id 	     NUMBER PRIMARY KEY NOT NULL,
+    name     VARCHAR(64)
+);
+INSERT INTO jetty_kinds VALUES (0, 'Buhnenkopf');
+INSERT INTO jetty_kinds VALUES (1, 'Buhnenfuß');
+INSERT INTO jetty_kinds VALUES (2, 'Buhnenwurzel');
+
+CREATE SEQUENCE JETTIES_ID_SEQ;
+CREATE TABLE jetties (
+    OGR_FID     NUMBER(38),
+    GEOM        MDSYS.SDO_GEOMETRY,
+    id          NUMBER PRIMARY KEY NOT NULL,
+    river_id 	NUMBER(38) REFERENCES rivers(id) ON DELETE CASCADE,
+    path       	VARCHAR(256),
+    kind_id    	NUMBER(38) REFERENCES jetty_kinds(id),
+    km 		NUMBER(7,3),
+    z        NUMBER(38,12)
+);
+INSERT INTO USER_SDO_GEOM_METADATA VALUES ('jetties', 'GEOM', MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',3282450,3912240,0.001),MDSYS.SDO_DIM_ELEMENT('Y',5248260,6100130,0.001),MDSYS.SDO_DIM_ELEMENT('Z',-100000,100000,0.002)), 31467);
+CREATE OR REPLACE TRIGGER jetties_trigger BEFORE INSERT ON jetties FOR EACH ROW
+    BEGIN
+        SELECT JETTIES_ID_SEQ.nextval INTO :new.id FROM dual;
+    END;
+/

http://dive4elements.wald.intevation.org