Unknown variable name when trying to update a CLOB in the database using a LOBLocator

I have a Query component on a form, which contains the following SQL code:

Code:
update organisation
set date_upd = :P_DATE
    ,reason_upd = :P_REASON
    ,Report_Upd = empty_clob()
where code = :P_CLIENT
    returning Report_Upd into :P_REPORT

In my code i do the following:

Code:
UpdateQuery.DeclareVariable( 'P_CLIENT', otString );
        UpdateQuery.DeclareVariable( 'P_DATE', otDate );
        UpdateQuery.DeclareVariable( 'P_REASON', otString );
        UpdateQuery.DeclareVariable( 'P_REPORT', otCLOB );

        UpdateQuery.SetVariable( 'P_CLIENT', LeftStr( lbl_Client.Caption, 12 ) );
        UpdateQuery.SetVariable( 'P_DATE', StrToDate(LeftStr( lbl_Date.Caption, 10 )) );
        UpdateQuery.SetVariable( 'P_REASON', lbl_Reason.Caption );
        LOB := TLOBLocator.Create(UpdateQuery.Session, otCLOB);
        Query.SetComplexVariable('P_REPORT', LOB);
        UpdateQuery.Execute;
        LOB.AsString := slTemp.GetText;

I'm not sure whether the AsString part can work, but it quits with the error: Unknown variable P_REPORT when i call execute.

Can anybody tell me what i'm doing wrong?
 
Well, nobody here seemed to notice a little typo in the code. (It was late ok?
wink.gif
).

But when i got in this morning i quickly discovered that in the delphi code it says: Query.SetComplexvariable...

which should of course be UpdateQuery.Set...

(For those interested: yes i also had a OracleQuery named Query on this form...)

One word: Sorry
redface.gif
 
Another fine example of Murphy's Law ;). Thanks for posting the solution though.

------------------
Marco Kalter
Allround Automations
 
Back
Top