Page 1 of 1

error with DBMS_LOB

Posted: Wed 13 Sep 2006 16:12
by bep
Hello,

we are using the Odac Net version 5.80.0.35 and we are getting problems when try to store to a clob field. We are using Delphi 7 and Oracle 9i.

Our code works fine without the Net option and it also works fine with a blob field.

The message error is:

ORA-21560: argument 2 is null, invalid, or out of range
ORA-06512: at "SYS.DBMS_LOB", line 775
ORA-06512: at line 1


the code is:

Code: Select all

//we prepare the following statement:

  sql := 'UPDATE table SET field=:FIELD WHERE condition';

  FSQL.ParamByName('FIELD').ParamType := ptInput;

//Check if it is a clob or blob

  if ABlobType=ftOraClob then
    begin
      FSQL.ParamByName('FIELD').AsOraClob.OCISvcCtx := FTmpTransaction.OCISvcCtx;
      FSQL.ParamByName('FIELD').AsOraClob.CreateTemporary(ltClob);
    end
    else
    begin
      FSQL.ParamByName('FIELD').AsOraBlob.OCISvcCtx := FTmpTransaction.OCISvcCtx;
      FSQL.ParamByName('FIELD').AsOraBlob.CreateTemporary(ltBlob);
    end;
    try
      if ABlobType=ftOraClob then
      begin
        FSQL.ParamByName('FIELD').AsOraClob.LoadFromStream(AValue);
        FSQL.ParamByName('FIELD').AsOraClob.WriteLob;   //<---- ERROR !!!!
      end
      else
      begin
        FSQL.ParamByName('FIELD').AsOraBlob.LoadFromStream(AValue);
        FSQL.ParamByName('FIELD').AsOraBlob.WriteLob;    
      end;
    except
      on E: Exception do
//Handle exception
    end;
//execute statement
...
Is there any problem in the components?

Thanks.

Posted: Thu 14 Sep 2006 13:45
by Challenger
We couldn't reproduce this error. Please specify versions of Oracle Server and Oracle Client you use. If it is possible send to ODAC support address complete sample that demonstrates this problem and include script to create server objects.

Posted: Thu 14 Sep 2006 17:31
by bep
we have sent a sample to [email protected].

We expect an answer

thanks

Posted: Thu 21 Sep 2006 08:35
by bep
challenger wrote:
"The error occurs because last symbol of the text that you insert into CLOB is #0. To make your
program work add line

FStream.Size := FStream.Size - 1;
before
SmartQuery.ParamByName('LOB').AsOraClob.LoadFromStream(FStream);

Best regards,
Oleg Plashkin "
thanks! It works...

Many, many thanks!