INSERT INTO Oracle LONG or LONGRAW

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
michaelp
Posts: 6
Joined: Mon 17 Sep 2007 14:47

INSERT INTO Oracle LONG or LONGRAW

Post by michaelp » Mon 17 Sep 2007 14:54

Hi there

I wish to insert a record into Oracle's "LONG RAW" or "LONG" fields.

Code used:
OraQuery1.Session.Connect;
OraQuery1.SQL.Text := 'INSERT INTO "MICHAEL"."TEST_ALL" ("TESTLONGRAW") VALUES (EMPTY_BLOB()) RETURNING TESTLONGRAW INTO :TESTLONGRAW ';
OraQuery1.ParamByName('TESTLONGRAW').ParamType := ptInput;
OraQuery1.ParamByName('TESTLONGRAW').LoadFromFile('C:\cvs\Projects\DataProducer\bin\klein.jpg', ftBlob);

OraQuery1.ExecSQL;

I get an error: "ORA-00932: inconsistent datatypes: expected NUMBER got LONG BINARY"

Using D6 with ODAC version "6.10.1.10 02.08.07"

Does anybody have any ideas on how to do it.

I know "LONG RAW" and "LONG" has been replaced by BLOB and CLOB, but I still need it for legacy systems.

Thanks
Michael

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 18 Sep 2007 07:45

You should use a SQL statement like this for LONG RAW and LONG fields:

Code: Select all

INSERT INTO "MICHAEL"."TEST_ALL" ("TESTLONGRAW") VALUES (:TESTLONGRAW)

Post Reply