LOB variable :FLD_MEM cannot be nil.

Hi,

I've made a simple application (Oracle 10, Delphi 7) but having problems updating CLOB fields via an update qry.

I have created a table:
CREATE TABLE TBL_001
( TBL1_SEQ NUMBER(8,0),
FLD_MEM CLOB
, CONSTRAINT PBL1_PK PRIMARY KEY
(
TBL1_SEQ
)
)

And an application with
TOracleDataSet( qry_DTSTbl1).SQL:
select
*
from
TBL_001

and
TOracleQuery( qry_Insert).SQL:
insert into TBL_001(
TBL1_SEQ
, FLD_MEM)
values(
TBL1_SEQ1.NEXTVAL
, :FLD_MEM)

and following Event:
procedure Tfrm_UpdateQry.qry_DTSTbl1ApplyRecord(Sender: TOracleDataSet;
Action: Char; var Applied: Boolean; var NewRowId: String);
begin
case Action of
'I' :
begin
Sender.DeclareQueryVariables( qry_Insert);
qry_Insert.Execute;
end;
else
begin
Applied := True;
end;
end;
end;

I 've tried to with persistent fields/variables etc. but whenever I try to insert a new record I get the errormessage: "LOB variable :FLD_MEM cannot be nil.".

Has anybody an idea what I 'm doing wrong?

Thx,
Maarten Bellekens.
 
If you are using a CLOB or BLOB variable, then you must explicitly create a temporary TLOBLocator instance, assign it to that variable by using SetComplexVariable, and set its value before you can execute the SQL.
 
I feared it was something like that, but in my application I don't know the type of the fields @ designtime.

I hoped the lines:
Sender.DeclareQueryVariables( qry_Insert);
qry_Insert.Execute;
would solve this but aparently I have to loop over all the variables to test on CLOB and BLOB and write something extra.

Thx for the help,
Maarten.
 
Back
Top