Error LOB Variable :LOB_COLUMN cannot be nil

planas

Member²
Hello,

Executing the following code we have this error : 'Error LOB Variable :LOB_COLUMN cannot be nil'

procedure TForm1.btn1Click(Sender: TObject);
var LOB: TLOBLocator;
Buffer: array[0..99] of char;
begin
// begin
// ... (PL/SQL) ...
//select lob_column
//into :lob_column from my_view_test
//where code_pk ='A' for update nowait;
// ... (PL/SQL) ...
//end;

with LOBQuery do
begin
Execute;
LOB := getcomplexvariable('LOB_COLUMN') as TLOBLocator;
Buffer:='foo bar';
LOB.Write(Buffer, 100);
LOB.Trim; // Set the size to the current position, which is 100
session.Commit;
end;
end;

Why ?

We just want to update a clob column in the view.

JP
 
You will need to create a TLOBLocator instance first, and assign it to the :lob_column variable:
Code:
with LOBQuery do
begin
  LOB := TLOBLocator.Create(otCLOB, Session);
  SetComplexVariable('lob_column', LOB);
  Execute;
  LOB.AsString := 'foo bar';
  Session.Commit;
  LOB.Free;
end;

------------------
Marco Kalter
Allround Automations
 
Trying what you tell us in your post, now we have the following error :

ORA-01036: illegal variable name/number

JP
 
Did you declare the variable? You can do so at design-time through the Variables property of the TOracleQuery, ot at run-time through TOracleQuery.DeclareVariable.

------------------
Marco Kalter
Allround Automations
 
The variable is declared at design time.
It is declared as CLOB.
And the error is always the same...

JP
 
Sorry, I got it the wrong way around. If you declare variables that are not included in the SQL text (as :variable), you will get an ORA-01036 error. Can you verify this? Can you also confirm that this select statement is included in a begin/end pair? This is necessary for a select ... into, and can lead to confusing errors otherwise.

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