AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Datenbanken Delphi MySQL- SQL-Script funktioniert nicht in Firebird
Thema durchsuchen
Ansicht
Themen-Optionen

MySQL- SQL-Script funktioniert nicht in Firebird

Ein Thema von juergen · begonnen am 13. Aug 2008 · letzter Beitrag vom 13. Aug 2008
Antwort Antwort
Benutzerbild von juergen
juergen

Registriert seit: 10. Jan 2005
Ort: Bönen
1.164 Beiträge
 
Delphi 11 Alexandria
 
#1

MySQL- SQL-Script funktioniert nicht in Firebird

  Alt 13. Aug 2008, 14:34
Datenbank: Firebird • Version: 2.1 • Zugriff über: IBExpert
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...
Jürgen
Indes sie forschten, röntgten, filmten, funkten, entstand von selbst die köstlichste Erfindung: der Umweg als die kürzeste Verbindung zwischen zwei Punkten. (Erich Kästner)
  Mit Zitat antworten Zitat
mkinzler
(Moderator)

Registriert seit: 9. Dez 2005
Ort: Heilbronn
39.851 Beiträge
 
Delphi 11 Alexandria
 
#2

Re: MySQL- SQL-Script funktioniert nicht in Firebird

  Alt 13. Aug 2008, 14:39
Er scheint die 2. Zeile nicht so zu nehmen. Definiere die Constraints mal extra
Markus Kinzler
  Mit Zitat antworten Zitat
Benutzerbild von DeddyH
DeddyH

Registriert seit: 17. Sep 2006
Ort: Barchfeld
27.542 Beiträge
 
Delphi 11 Alexandria
 
#3

Re: MySQL- SQL-Script funktioniert nicht in Firebird

  Alt 13. Aug 2008, 14:41
Außerdem ist level wohl ein reserviertes Wort.
Detlef
"Ich habe Angst vor dem Tag, an dem die Technologie unsere menschlichen Interaktionen übertrumpft. Die Welt wird eine Generation von Idioten bekommen." (Albert Einstein)
Dieser Tag ist längst gekommen
  Mit Zitat antworten Zitat
mkinzler
(Moderator)

Registriert seit: 9. Dez 2005
Ort: Heilbronn
39.851 Beiträge
 
Delphi 11 Alexandria
 
#4

Re: MySQL- SQL-Script funktioniert nicht in Firebird

  Alt 13. Aug 2008, 14:42
Zitat von DeddyH:
Außerdem ist level wohl ein reserviertes Wort.
was man durch Quoten umgehen könnte, besser ab ändern
Markus Kinzler
  Mit Zitat antworten Zitat
Benutzerbild von DeddyH
DeddyH

Registriert seit: 17. Sep 2006
Ort: Barchfeld
27.542 Beiträge
 
Delphi 11 Alexandria
 
#5

Re: MySQL- SQL-Script funktioniert nicht in Firebird

  Alt 13. Aug 2008, 14:46
Ich würde auch id_level daraus machen, das ist IMHO besser als quoten.
Detlef
"Ich habe Angst vor dem Tag, an dem die Technologie unsere menschlichen Interaktionen übertrumpft. Die Welt wird eine Generation von Idioten bekommen." (Albert Einstein)
Dieser Tag ist längst gekommen
  Mit Zitat antworten Zitat
Benutzerbild von juergen
juergen

Registriert seit: 10. Jan 2005
Ort: Bönen
1.164 Beiträge
 
Delphi 11 Alexandria
 
#6

Re: MySQL- SQL-Script funktioniert nicht in Firebird

  Alt 13. Aug 2008, 14:53
Hallo,
Bingo, "Level" ist in FB ein reserviertes Wort!
Ich hatte das auch schon geändert, hatte dann aber noch weitere Fehler, so dass ich auf diesen Schluss nicht gekommen bin.

Danke Euch beiden!
Jürgen
Indes sie forschten, röntgten, filmten, funkten, entstand von selbst die köstlichste Erfindung: der Umweg als die kürzeste Verbindung zwischen zwei Punkten. (Erich Kästner)
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:51 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz