Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Datenbanken (https://www.delphipraxis.net/15-datenbanken/)
-   -   Delphi Zeos und Clob (https://www.delphipraxis.net/75600-zeos-und-clob.html)

slang 22. Aug 2006 08:53

Datenbank: Oracle • Version: 8 • Zugriff über: Zeos

Zeos und Clob
 
Hallo!

Ich habe ein Problem wenn ich eine Datenbanktabelle, in welcher ein Clob-Feld vorkommt, mit Zeos komplett auslesen will.
Ich will die Tabelle auslesen und die Datentypen in einem Stringgrid auflisten.
Ich will nicht den Inhalt des Clob-Feldes auslesen! Nur den Datentyp rausfinden!
Sobald die Query ausgeführt wird, wird folgende Fehlermeldung angezeigt:

SQL-Error: ORA-00932: nicht übereinstimmende Datentypen

Die Fehlermeldung kommt auch, wenn ich die Query gar nicht auswerte, sondern nur ausführe.
Diese Fehlermeldung kommt nur bei Tabellen, welche Clob-Felder beinhalten.

Kann man dieses Problem irgendwie umgehen?

Die Funktion zum Auslesen sieht so aus:

Delphi-Quellcode:
procedure TForm1.Button5Click(Sender: TObject);
var
  i,j : integer;
begin
  ZConnection1.Database := ComboBox1.Text;
  ZConnection1.User := Edit1.Text;
  ZConnection1.Password := Edit2.Text;

  ZConnection1.Connect;

  ZQuery1.SQL.Text := Memo2.Text; // SELECT * FROM vorgang
  ZQuery1.Active := true;
  ZQuery1.First;


  // Stringgrid leeren
  Stringgrid1.ColCount := 1;
  Stringgrid1.RowCount := 1;

  // Stringgrid auf Anzahl der Ergebnisse anpassen
  StringGrid1.ColCount := ZQuery1.FieldCount;
  StringGrid1.RowCount := ZQuery1.RecordCount + 1;

  // Eine Überschriftenzeile einfügen
  Stringgrid1.FixedRows := 1;

  //Überschriftenzeile mit den Tabellennamen füllen
  for i := 0 to StringGrid1.ColCount - 1 do
    Stringgrid1.Cells[i,0] := ZQuery1.Fields[i].FieldName;

  // Stringgrid mit Daten aus der Abfrage füllen
  for i := 0 to ZQuery1.RecordCount - 1 do
  begin
    Application.ProcessMessages;
    for j := 0 to ZQuery1.FieldCount - 1 do
     begin
      Case ZQuery1.Fields[j].DataType of
        ftDate:
          StringGrid1.Cells[j,i+1] := 'Date field';
        ftUnknown:
          StringGrid1.Cells[j,i+1] := 'Unknown field';
        ftString:
          StringGrid1.Cells[j,i+1] := 'String field';
        ftSmallint:
          StringGrid1.Cells[j,i+1]:='16-bit integer field';
        ftInteger:
          StringGrid1.Cells[j,i+1]:='32-bit integer field';
        ftWord:
          StringGrid1.Cells[j,i+1]:='16-bit unsigned integer field';
        ftBoolean:
          StringGrid1.Cells[j,i+1]:='Boolean field';
        ftFloat:
          StringGrid1.Cells[j,i+1]:='Floating-point numeric field';
        ftCurrency:
          StringGrid1.Cells[j,i+1]:='Money field';
        ftBCD:
          StringGrid1.Cells[j,i+1]:='Binary-Coded Decimal field';
        ftTime:
          StringGrid1.Cells[j,i+1]:='Time field';
        ftDateTime:
          StringGrid1.Cells[j,i+1]:='Date and time field';
        ftBytes:
          StringGrid1.Cells[j,i+1]:='Fixed number of bytes (binary storage)';
        ftVarBytes:
          StringGrid1.Cells[j,i+1]:='Variable number of bytes (binary storage)';
        ftAutoInc:
          StringGrid1.Cells[j,i+1]:='Auto-incrementing 32-bit integer counter field';
        ftBlob:
          StringGrid1.Cells[j,i+1]:='Binary Large OBject field';
        ftMemo:
          StringGrid1.Cells[j,i+1]:='Text memo field';
        ftGraphic:
          StringGrid1.Cells[j,i+1]:='Bitmap field';
        ftFmtMemo:
          StringGrid1.Cells[j,i+1]:='Formatted text memo field';
        ftParadoxOle:
          StringGrid1.Cells[j,i+1]:='Paradox OLE field';
        ftDBaseOle:
          StringGrid1.Cells[j,i+1]:='dBASE OLE field';
        ftTypedBinary:
          StringGrid1.Cells[j,i+1]:='Typed binary field';
        ftCursor:
          StringGrid1.Cells[j,i+1]:='Output cursor from an Oracle stored procedure (TParam only)';
        ftFixedChar:
          StringGrid1.Cells[j,i+1]:='Fixed character field';
        ftWideString:
          StringGrid1.Cells[j,i+1]:='Wide string field';
        ftLargeInt:
          StringGrid1.Cells[j,i+1]:='Large integer field';
        ftADT:
          StringGrid1.Cells[j,i+1]:='Abstract Data Type field';
        ftArray:
          StringGrid1.Cells[j,i+1]:='Array field';
        ftReference:
          StringGrid1.Cells[j,i+1]:='REF field';
        ftDataSet:
          StringGrid1.Cells[j,i+1]:='DataSet field';
        ftOraBlob:
          StringGrid1.Cells[j,i+1]:='BLOB fields in Oracle 8 tables';
        ftOraClob:
          StringGrid1.Cells[j,i+1]:='CLOB fields in Oracle 8 tables';
        ftVariant:
          StringGrid1.Cells[j,i+1]:='Data of unknown or undetermined type';
        ftInterface:
          StringGrid1.Cells[j,i+1]:='References to interfaces (IUnknown)';
        ftIDispatch:
          StringGrid1.Cells[j,i+1]:='References to IDispatch interfaces';
        ftGuid:
          StringGrid1.Cells[j,i+1]:='globally unique identifier (GUID) values';
        ftTimeStamp:
          StringGrid1.Cells[j,i+1]:='Timestamp field';
        ftFMTBcd:
          StringGrid1.Cells[j,i+1]:='FMTBcd field';
        else
          StringGrid1.Cells[j,i+1]:='Irgendwas anderes';
      end;
     end;
    Label2.Caption := IntToStr(ZQuery1.RecNo);
    ZQuery1.Next;
  end;

  // DB-Verbindung beenden
  ZConnection1.Disconnect;
Die Tabelle vorgang ist folgendermaßen aufgebaut:
Delphi-Quellcode:
 VORGANG_ID                               NOT NULL NUMBER(11)
 PERSON_ID                                NOT NULL NUMBER(11)
 UPDATED                                           DATE
 UPDATED_BY                                        VARCHAR2(32)
 CREATED                                           DATE
 CREATED_BY                                        VARCHAR2(32)
 VORGANG_TYP                                       NUMBER(3)
 MEDIUM_ID                                         NUMBER(11)
 SUBJECT                                           VARCHAR2(255)
 CATEGORY                                 NOT NULL NUMBER(11)
 ZUGEWIESEN_AN                                     NUMBER(11)
 STATUS                                   NOT NULL NUMBER(3)
 PRIORITAET                               NOT NULL NUMBER(3)
 WIEDERVORLAGE                                     CHAR(1)
 WIEDERVORLAGE_DATUM                               DATE
 FERTIGSTELLUNG_PLAN                               DATE
 FERTIGSTELLUNG_IST                                DATE
 FERTIGSTELLUNG_DURCH                              VARCHAR2(32)
 BEMERKUNGEN                                       CLOB
 HISTORY                                           CLOB
Ich hoffe mir kann da jemand helfen.
Danke im Voraus :-)

MfG

slang

Bernhard Geyer 22. Aug 2006 11:30

Re: Zeos und Clob
 
Clobs. Da bist du auf einen schönen Datentypen von Oracle gestoßen.

Je nach genauer Oracle-Client-Version (Version 8 ist hier zu ungenau) und der verwendeten Codierung auf der Datenbank und im Client treten Unterschiedliche Fehler/Probleme aus.


Alle Zeitangaben in WEZ +1. Es ist jetzt 20:47 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz