Additional
dbCAP
AnyDAC
ThinDAC
NCOCI8
Topic: StoredProcedure with CLOB param
StoredProcedure with CLOB param
Posted: 2005/08/02 01:14
 
Hi,

I have this procedure in package specification:

PROCEDURE AddItem (aNAME DVS_ITEM.NAME%TYPE,
aNOTETEXT DVS_RTFNOTE.NOTETEXT%TYPE,
aIDREALM DVS_REALM.IDREALM%TYPE DEFAULT NULL);

where DVS_RTFNOTE.NOTETEXT%TYPE is CLOB.

In Delphi 6 with NCOCI8 ver. 1.0.3, Oracle 9i R2 and corresponding client I have spNewRtfNote of type TOCIStoredProcedure with params, where param aNOTETEXT has datatype ftOraClob, ODataType is otCLOB, ODataSize 4, OParamType odIn, ParamType prInput, ArrayLen 1.

I want to fill this params with folowing code:

procedure SetClobParam (aParam: TOCIParam; const aValue: string);
var
vStringList: TStringList;
vMemoryStream: TMemoryStream;
vDBParamStream: TStream;
begin
vStringList := TStringList.Create;
try
vStringList.Text := aValue;

vMemoryStream := TMemoryStream.Create;
try
vStringList.SaveToStream(vMemoryStream);
vMemoryStream.Seek (0, soFromBeginning);
aParam.IsNull := False;

vDBParamStream := aParam.CreateBlobStream(0, bmWrite);
vDBParamStream.CopyFrom (vMemoryStream, 0);
finally
vMemoryStream.Free;
end;
finally
vStringList.Free;
end;
end;

but on line vDBParamStream.CopyFrom I get exception EOCIDBError with message NOE120/BLOB - BLOB field [%s] readonly.

What is the right way to fill this CLOB param?

Thank in advance for your answer.

Slavek Rydval