CLOB Insert error

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
eric92

CLOB Insert error

Post by eric92 » Tue 04 Oct 2005 07:10

Using
with OraSession do
begin
Options.Net := True;
Options.CharLength := 0;
Options.Charset := '';
Options.UseUnicode := True;
end;

Server script :
CREATE TABLE ODAC_CLOB
(
CODE VARCHAR2(30 BYTE),
TITLE VARCHAR2(30 BYTE),
VALUE CLOB
)


Application query:
INSERT INTO odac_clob(code, title, value)
VALUES (:code, :title, EMPTY_CLOB())
RETURNING
value
INTO
:value


SmartQuery1.ParamByName('code').AsString := 'Code Key';
SmartQuery1.ParamByName('title').AsString := 'titel subject';
SmartQuery1.ParamByName('value').ParamType := ptInput;
SmartQuery1.ParamByName('value').DataType := ftOraClob;
SmartQuery1.ParamByName('value').AsOraClob.AsString := '안녕하세요'; <--- korean character
SmartQuery1.Execute;

excuted..
error return..

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

why?

Paul
Posts: 725
Joined: Thu 28 Oct 2004 14:06

Post by Paul » Tue 04 Oct 2005 11:30

You must use the following code in this situation

Code: Select all

SmartQuery1.ParamByName('value').AsOraClob.IsUnicode := True;
  SmartQuery1.ParamByName('value').AsOraClob.AsWideString := Widestring('안녕하세요'); //<--- korean 

eric92

Post by eric92 » Wed 05 Oct 2005 02:11

thank you Paul!!!!!
Paul wrote:You must use the following code in this situation

Code: Select all

SmartQuery1.ParamByName('value').AsOraClob.IsUnicode := True;
  SmartQuery1.ParamByName('value').AsOraClob.AsWideString := Widestring('안녕하세요'); //<--- korean 

Post Reply