Board index » delphi » RESEND Oracle 8.1.7 SP to INSERT a BMP into a blob column

RESEND Oracle 8.1.7 SP to INSERT a BMP into a blob column


2003-12-30 09:00:23 AM
delphi206
Can someone please pick this up?
Happy Holidays,
Ronan van Riet
"Ronan van Riet" <XXXX@XXXXX.COM>writes
Quote
Hello,

Using Delphi 6 Enterprise Update 2 and RTL3. Oracle 8.1.7 Enterprise.

I am trying to insert a BMP to an Oracle 8.1.7 blob column through a SP.

The error I am getting is:
PLS-00306 wrong number of arguments in call to 'ADDBMP'
ORA-06550

The created ms does contains data. In future I'd like to insert larger
images (< 5 mb).

I thnk the problem is related to the mismatch in data types between the SP
and ADO_SP_ADDBMP.
- When trying to use the ftOraBlob datatype an error occurs: Argument are
of
wrong type, are out of acceptable range, or are in conflict with one
another.
- When using ftBlob the PLS-00406 error occurs.

I do want to INSERT using an SP. How can this be resolved?

Any help appreciated,
Ronan van Riet


CREATE TABLE IMAGE
( id, varchar2 not null,
project BLOB)

PROCEDURE ADDBMP( pBMP IN VARCHAR2)
IS
BEGIN
INSERT INTO IMAGES (id, bmp) VALUES (IMAGE_ROW_ID_SQ.NEXTVAL, pBMP);
END; -- Procedure

object ADO_SP_ADDBMP: TADOStoredProc
Connection = ADOConnection1
ProcedureName = 'ADDBMP'
Parameters = <
item
Name = 'pBMP'
DataType = ftString
Size = 4000
Value = Null
end>
Left = 144
Top = 8
end

procedure TForm1.btAddBMPClick(Sender: TObject);
var
ms: tMemoryStream;
s: string;
bitmap: tBitmap;
begin
if OpenPictureDialog1.Execute then begin
bitmap := tBitmap.Create;
bitmap.LoadFromFile(OpenPictureDialog1.FileName);
image1.picture.assign(bitmap);
with ADO_SP_ADDBMP.Parameters do begin
ms := tmemorystream.Create;
ms.clear;
image1.Picture.Bitmap.SaveToStream(ms);
ms.position := 0;
setstring(s, pChar(ms.memory), ms.size);
ParamByName('pBMP').Value := s;
ADO_SP_ADDBMP.ExecProc;
end;
end;
end;


 
 

Re:RESEND Oracle 8.1.7 SP to INSERT a BMP into a blob column

Quote
>I am trying to insert a BMP to an Oracle 8.1.7 blob column through a SP.
why?
try:
Insert into image (id, project) values (:id, empty_blob()) returning project
into :project
Quote
>CREATE TABLE IMAGE
>( id, varchar2 not null,
>project BLOB)
And the NEXTVAL of ' id' would be? I'd expect something like Number(10)
instead of VARCHAR2 (length ?)
By the way, I did an experiment with ADO once (2-3 years ago) to see why one
would use it in combination with Oracle. As far as I remember I then
concluded that ADO meant Another Dumb Option when used in combination with
Oracle (Blobs where a pita then, I'd expect it to be solved now). Do
yourself a favor: get ODAC (crlab.com), makes working with Oracle a
whole lot easier.
regards,
Martin
 

Re:RESEND Oracle 8.1.7 SP to INSERT a BMP into a blob column

Or Direct Oracle Access (www.allroundautomations.com). I have used is for 5
years now and wouldn't use anything else to access Oracle from Delphi.
"Martin Brekhof" <XXXX@XXXXX.COM>writes
Quote

>>I am trying to insert a BMP to an Oracle 8.1.7 blob column through a
SP.
why?
try:
Insert into image (id, project) values (:id, empty_blob()) returning
project
into :project

>>CREATE TABLE IMAGE
>>( id, varchar2 not null,
>>project BLOB)
And the NEXTVAL of ' id' would be? I'd expect something like
Number(10)
instead of VARCHAR2 (length ?)


By the way, I did an experiment with ADO once (2-3 years ago) to see why
one
would use it in combination with Oracle. As far as I remember I then
concluded that ADO meant Another Dumb Option when used in combination with
Oracle (Blobs where a pita then, I'd expect it to be solved now). Do
yourself a favor: get ODAC (crlab.com), makes working with Oracle a
whole lot easier.

regards,
Martin