Delphi oracle blob

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

+4
source share
2 answers

Check out these samples with TAdoQuery .

Loading 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 Stream to load 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 should know that the Microsoft Oracle oledb driver not compatible with blob fields instead of using the Oracle OLEDB provider .

As a final tip, if you can, try using other components to connect to ORACLE, such as dbexpress, ANYDAC or ODAC components

+6
source

Keep in mind that Oracle has a special way to handle LOB. It uses Large Object Locators (a kind of handle) to perform operations with large objects. INSERT returns a LOB locator, which is then used, for example, to populate the LOB. This operation may be performed behind the scenes by the driver / library used to access Oracle, or it may require some coding.

0
source

Source: https://habr.com/ru/post/1335836/


All Articles