Page 1 of 1

ORA-22275: invalid LOB locator specified

Posted: Fri 01 Feb 2013 07:55
by lepr8
Hi, I obtain this error when i do a INSERT SQL command in a table where CLOB field is present.

Example

create table ART_1 (
id number(5,0) not null,
testo CLOB not null
)

.........
valore:='TEST'
sql.Text:='insert into ART_1 values (100,:a1)';
Params[0].DataType:=ftOraClob;
stream:=TStringStream.create(valore);
stream.Position:=0;
Params[0].LoadFromStream(stream,ftOraClob);
stream.free;
ExecSQL();


Thanks.

Re: ORA-22275: invalid LOB locator specified

Posted: Fri 01 Feb 2013 11:10
by AlexP
Hello,

To insert CLOB/BLOB values, you should use Oracle EMPTY_CLOB/EMPTY_BLOB functions. The following is your fixed sample:

Code: Select all

  valore := 'TEST';
  SQLQuery1.sql.Text := 'insert into ART_1(id, testo) values (100,EMPTY_CLOB()) RETURNING testo  INTO :testo';
  SQLQuery1.Params[0].ParamType := ptInput;
  SQLQuery1.Params[0].DataType := ftOraClob;
  stream := TStringStream.create(valore);
  stream.Position:=0;
  SQLQuery1.Params[0].LoadFromStream(stream,ftOraClob);
  stream.free;
  SQLQuery1.ExecSQL();

Re: ORA-22275: invalid LOB locator specified

Posted: Fri 01 Feb 2013 14:09
by lepr8
thanks for reply.

it's work.


thank you very much!

Re: ORA-22275: invalid LOB locator specified

Posted: Fri 01 Feb 2013 14:26
by AlexP
Hello,

Glad to see that the problem was solved. If you have any other questions, feel free to contact us.

Re: ORA-22275: invalid LOB locator specified

Posted: Fri 14 Jun 2013 06:47
by Ting
sorry. I have the same problem.
I have to use stored procedure to assigned the clob field.
How could I specify the LOB locator through stored procedure? :cry:

Re: ORA-22275: invalid LOB locator specified

Posted: Fri 14 Jun 2013 10:17
by AlexP
Hello,

Please specify your IDE version