Hallo zusammen,
ich beschäftige mich momentan "etwas" mit
DB...
Dazu habe ich ein Projekt aufgegriffen (
opengeodb).
Nun habe ich mich damit schon etwas länger befasst (und will auch weitermachen), finde aber nichts, warum folgender
MySQL-Sript als Firebird-
SQL-Script ab der 3. Zeile nicht funktioniert:
SQL-Code:
create table geodb_hierarchies (
loc_id integer not null references geodb_locations,
level integer not null check (level>0 and level<=9),
id_lvl1 integer not null,
id_lvl2 integer,
id_lvl3 integer,
id_lvl4 integer,
id_lvl5 integer,
id_lvl6 integer,
id_lvl7 integer,
id_lvl8 integer,
id_lvl9 integer,
valid_since date,
date_type_since integer,
valid_until date not null,
date_type_until integer not null
check (
(
(level = 1 and /* loc_id = id_lvl1 and */
id_lvl2 is null and id_lvl3 is null and
id_lvl4 is null and id_lvl5 is null and
id_lvl6 is null and id_lvl7 is null and
id_lvl8 is null and id_lvl9 is null) or
(level = 2 and /* loc_id = id_lvl2 and */
id_lvl1 is not null and id_lvl3 is null and
id_lvl4 is null and id_lvl5 is null and
id_lvl6 is null and id_lvl7 is null and
id_lvl8 is null and id_lvl9 is null) or
(level = 3 and /* loc_id = id_lvl3 and */
id_lvl1 is not null and id_lvl2 is not null and
id_lvl4 is null and id_lvl5 is null and
id_lvl6 is null and id_lvl7 is null and
id_lvl8 is null and id_lvl9 is null) or
(level = 4 and /* loc_id = id_lvl4 and */
id_lvl1 is not null and id_lvl2 is not null and
id_lvl3 is not null and id_lvl5 is null and
id_lvl6 is null and id_lvl7 is null and
id_lvl8 is null and id_lvl9 is null) or
(level = 5 and /* loc_id = id_lvl5 and */
id_lvl1 is not null and id_lvl2 is not null and
id_lvl3 is not null and id_lvl4 is not null and
id_lvl6 is null and id_lvl7 is null and
id_lvl8 is null and id_lvl9 is null) or
(level = 6 and /* loc_id = id_lvl6 and */
id_lvl1 is not null and id_lvl2 is not null and
id_lvl3 is not null and id_lvl4 is not null and
id_lvl5 is not null and id_lvl7 is null and
id_lvl8 is null and id_lvl9 is null) or
(level = 7 and /* loc_id = id_lvl7 and */
id_lvl1 is not null and id_lvl2 is not null and
id_lvl3 is not null and id_lvl4 is not null and
id_lvl5 is not null and id_lvl6 is not null and
id_lvl8 is null and id_lvl9 is null) or
(level = 8 and /* loc_id = id_lvl8 and */
id_lvl1 is not null and id_lvl2 is not null and
id_lvl3 is not null and id_lvl4 is not null and
id_lvl5 is not null and id_lvl6 is not null and
id_lvl7 is not null and id_lvl9 is null) or
(level = 9 and /* loc_id = id_lvl9 and */
id_lvl1 is not null and id_lvl2 is not null and
id_lvl3 is not null and id_lvl4 is not null and
id_lvl5 is not null and id_lvl6 is not null and
id_lvl7 is not null and id_lvl8 is not null)
) and
(
(valid_since is null and date_type_since is null) or
(valid_since is not null and date_type_since is not null)
)
)
)
Es kommt folgende Fehlermeldung:
Zitat:
The next statement causes the following error:
Invalid token.
Dynamic
SQL Error.
SQL error code = -104.
Token unknown - line 3, column 3.
level.
Ich habe da nun schon etliches gelesen und gesucht, finde aber nicht heraus, wo hier das Problem liegt.
Ich denke hier ist eine Anpassung an die Firebird Syntax notwendig.
Völlig unklar ist mir, was "level" zu besagen hat und der Zusammenahng zu "check"...
Über Hilfe würde ich mich freuen.
Und habt bitte Nachsehen, ich stehe erst gaaanz am Anfang...