Thema: Delphi Fehler in SQL Statement?

Einzelnen Beitrag anzeigen

Benutzerbild von BeerBear
BeerBear

Registriert seit: 23. Aug 2005
Ort: Lübeck
85 Beiträge
 
#1

Fehler in SQL Statement?

  Alt 24. Okt 2005, 09:47
Datenbank: Oracle • Zugriff über: ?
Guten Morgen,

Ich hab da mal 2 SQL Statements, die bei mir Fehler verursachen. Vielleicht sieht ja jemand den Fehler.

Zum einen: Rechtes Anführungszeichen fehlt.

Delphi-Quellcode:
with TQuery( DS ) do
        begin
          SQL.Clear;
          SQL.Add(' Select REKV_ID as COLUMN1, REKV_TYP as COLUMN2, LF_NAME as COLUMN3, REKV_URSACHE as COLUMN4, REKV_URSACHE_CODE as COLUMN5 from REK_VERU, LF_STM ');
          SQL.Add(' where ( REKV_REKF_ID = :REKF_ID ) and ( REKV_TYP = ''L'' ) and ( REKV_REF_ID = LF_ID (+)) union ');
          SQL.Add(' Select REKV_ID as COLUMN1, REKV_TYP as COLUMN2, KD_NAME as COLUMN3, REKV_URSACHE as COLUMN4, REKV_URSACHE_CODE as COLUMN5 from REK_VERU, KD_STM ');
          SQL.Add(' where ( REKV_REKF_ID = :REKF_ID ) and ( REKV_TYP = ''K'' ) and ( REKV_REF_ID = KD_ID (+)) union ');
          SQL.Add(' Select REKV_ID as COLUMN1, REKV_TYP as COLUMN2, QM_ABTEILUNG as COLUMN3, REKV_URSACHE as COLUMN4, REKV_URSACHE_CODE as COLUMN5 from REK_VERU, QM_ABT ');
          SQL.Add(' where ( REKV_REKF_ID = :REKF_ID ) and ( REKV_TYP = ''I'' ) and ( REKV_REF_ID = QM_ABT_ID (+)) union ');
          SQL.Add(' Select REKV_ID as COLUMN1, REKV_TYP as COLUMN2, '' as COLUMN3, REKV_URSACHE as COLUMN4, REKV_URSACHE_CODE as COLUMN5 from REK_VERU, KD_STM ');
          SQL.Add(' where ( REKV_REKF_ID = :REKF_ID ) and ( REKV_TYP in ( ''S'',''O'' ) ) ');
          SQL.Add(' order by 2,3 ');
        end;
Und zum Anderen ein allgemeiner SQL Fehler.

Delphi-Quellcode:
with TQuery( DS ) do
        begin
          SQL.Add(' select fd.*, fst.CA_FS_BEZ, ms.CA_MS_NR ');
          SQL.Add(' from ');
          SQL.Add(' REK_FD_PPM fd, CA_FERT_ST fst, CA_MASCH ms ');
          SQL.Add(' where ');
          SQL.Add(' ( fd.REKFD_REKF_ID = :REKF_ID ) and ');
          SQL.Add(' ( fd.REKFD_FS_ID = fst.CA_FS_ID (+)) and ');
          SQL.Add(' ( fd.REKFD_MAS_ID = ms.CA_MS_ID (+)) ');
          SQL.Add(' order by REKFD_DATUM desc ');
        end;
Der Fehler sitzt immer vor dem Bildschirm.
  Mit Zitat antworten Zitat