4

how to insert blob data into oracle xe from delphi 7 (ado component)

2 Answers 2

6

Check these samples using a TAdoQuery component.

loading the data directly from a file

 ADOQuery1.Parameters.AddParameter.Name:='Param1';
 ADOQuery1.Parameters.ParamByName('Param1').LoadFromFile('yourfilename',ftBlob);
 ADOQuery1.SQL.Add('INSERT INTO TableName (FieldName) VALUES (:Param1)');
 ADoQuery1.ExecSQL;

using a Stream to load the data

 ADOQuery1.Parameters.AddParameter.Name:='Param1';
 ADOQuery1.Parameters.ParamByName('Param1').LoadFromStream(AStream,ftBlob);
 ADOQuery1.SQL.Add('INSERT INTO TableName (FieldName) VALUES (:Param1)');
 ADoQuery1.ExecSQL;

you must be aware which the Microsoft Oracle oledb driver is not compatible with blob fields try instead using the Oracle OLEDB provider.

As final advice if you can, try using another components to connect to ORACLE like dbexpress, ANYDAC or the ODAC components

Sign up to request clarification or add additional context in comments.

Comments

0

Be aware that Oracle has a peculiar way to handle LOBs. It uses "LOB locators" (a sort of handles) to perform operations on LOBs. An INSERT returns a LOB locator that is then used to fill the LOB, for example. That operation could be performed "behind the scenes" by the driver/library used to access Oracle, or may require some coding.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.