Page 1 of 1

ORA-01461 on LoadFromStream with Blob-Field Param

Posted: Wed 28 May 2014 05:48
by dachs
Hello,

I created a table like this

CREATE TABLE DACHS_MSG (ID INT NOT NULL, DATETIME DATE NOT NULL, CLIENTID VARCHAR2(50) NOT NULL, MSG BLOB NOT NULL);

and try to insert using an TOraQuery and TOraParams in this way:

Code: Select all

TOraSession* OraSession = new TOraSession( this->Owner);
OraSession->Server = "...";
OraSession->Username = "...";
OraSession->Password = "...";
OraSession->Options->OptimizerMode = omAllRows;
OraSession->Open();

TOraQuery* DBOraQuery = new TOraQuery( NULL);
DBOraQuery->Connection = OraSession;
DBOraQuery->FetchAll = true;
DBOraQuery->ParamCheck = true;
DBOraQuery->Params->Clear();
DBOraQuery->SQL->Clear();
DBOraQuery->SQL->Add( "INSERT INTO DACHS_MSG (ID, DateTime, ClientID, Msg) (SELECT DACHSMSGID_SEQ.NEXTVAL, sysdate, :ClientID, :Msg FROM DUAL)");

TOraParam* MsgParam = DBOraQuery->Params->ParamByName( "Msg");
MsgParam->ParamType = ptInput;
MsgParam->DataType = ftBlob;
MsgParam->LoadFromStream( MessageStream, ftBlob); // MessageStream is a TMemoryStream*

TOraParam* ClientParam = DBOraQuery->Params->ParamByName( "ClientID");
ClientParam->ParamType = ptInput;
ClientParam->DataType = ftString;
ClientParam->AsString = "Test";

DBOraQuery->Prepare();
DBOraQuery->Execute();
That works fine, but when the size of MessageStream is greater than 4000, I get the ORA-01461 Error (can bind a LONG value only for insert into a LONG column).

How can I insert a big Stream into this field?

Thank you

Re: ORA-01461 on LoadFromStream with Blob-Field Param

Posted: Wed 28 May 2014 07:17
by AlexP
We cannot reproduce the problem. Please try to reproduce the problem on the latest ODAC version 9.3.8.