TLobLocator and Updating CLOB/BLOB Data

How do I update a CLOB or BLOB ???

I tried the following code and get an error when executing line "LOB.AsString := StringList_WhoIsResults.Text;":

The Error is:
"Project OPP.exe raised exception class EOracleError with message 'ORA-22920: row containing the LOB is not locked'."

Any Ideas how to update the Clob/Blob so it works ???
-Brooks

LOB := TLOBLocator.Create(OracleSession1, otCLOB);
try
with OracleQuery_StoreWhoIsResults do begin
DeleteVariables;
SQL.Clear;
SQL.Add( 'BEGIN' );
SQL.Add( 'SELECT whois_body into :WHOIS_BODY' );
SQL.Add( 'FROM dnc.opp_assignments' );
SQL.Add( 'WHERE ID = :ID;' );
SQL.Add( 'EXCEPTION' );
SQL.Add( 'WHEN OTHERS THEN RAISE;' );
SQL.Add( 'END;' );
DeclareVariable('ID',otFloat);
DeclareVariable('WHOIS_BODY',otCLOB);
SetVariable('ID', WhoIsInfo.Assignment_ID);
SetComplexVariable('WHOIS_BODY', LOB);
Execute;
LOB.AsString := StringList_WhoIsResults.Text;
end;
finally
LOB.Free;
LOB := Nil;
end;
 
The row must be locked. You can modify your code like this:

SQL.Add( 'SELECT whois_body into :WHOIS_BODY' );
SQL.Add( 'FROM dnc.opp_assignments' );
SQL.Add( 'WHERE ID = :ID' );
SQL.Add( 'FOR UPDATE;' );

The for update clause will lock the record, so that you can subsequently write the CLOB data.
 
Back
Top