How to access a long raw column?

DanCT

Member
Hello,

I'm using Delphi 5, with DOA 3.4.6 to connect to an Oracle 9i database. I have a long raw column that I'm trying to access, with the eventual goal of storing each line (it's mostly text) in a TMemo.

I cannot get this to work. So far, I'm using:

Code:
TheBlob := TLOBLocator.Create(Oracle,otBlob);

    with SQLQuery do
    begin
        Session := Oracle;
        SQL.Clear;
        SQL.Add('SELECT longrawcol FROM mytable WHERE id = 1');
        Execute;
    end;

    TheBlob := SQLQuery.LOBField(0);
The error that I get is "Field LONGRAWCOL is not a LOB".

Any ideas?
 
From the User's Guide:

Long Raws are handled as zero based variant arrays of bytes. To access the byte-array with the highest possible performance, make use of the VarArrayLock and VarArrayUnlock functions. To check for the size of the value, make use of VarArrayHighBound. The next example fetches a picture, determines the size, and saves the binary data to disk:
Code:
// SelectEmpPictureQuery.SQL =
// select picture from emp
// where empno = :empno
try
  with SelectEmpPictureQuery do
  begin
    SetVariable('EMPNO', Emp.EmpNo);
    Execute;
    Picture := Field('PICTURE');
    Size    := VarArrayHighBound(Picture, 1) + 1;
    Ptr     := VarArrayLock(Picture);
    WriteFile('Employee.gif', Ptr^, Size);
    VarArrayUnlock(Picture);
  end;
except
  on E:EOracleError do ShowMessage(E.Message);
end;
 
Originally posted by DanCT:

I'm using Delphi 5, with DOA 3.4.6 to connect to an Oracle 9i database. I have a long raw column that I'm trying to access
There is a demo named LongRaw in the Demos directory of DOA.
 
Back
Top