Devart Forum Index

The time now is Thu 09 Sep 2010 12:54

Insert and Update CLOB fields over 4000 characters

 
Post new topic   Reply to topic    Devart Forum Index -> dbExpress driver for Oracle
View previous topic :: View next topic  
Author Message
dmuntane



Joined: 13 Jul 2010
Posts: 1

PostPosted: Tue 13 Jul 2010 10:12    Post subject: Insert and Update CLOB fields over 4000 characters Reply with quote

When inserting/updating CLOB fields with a size over 4000, field value is set to null.

Environment:
Delphi 7
dbexpoda.dll: Version 4.50.0.21
Oracle: Version 9i and 10 (XE)

Test cases:

CREATE TABLE TEST (CLOBFIELD CLOB)
INSERT INTO TEST (CLOBFIELD) VALUES (<S_GREATER_THAN_4000>)
Result: No data is stored

UPDATE TEST SET CLOBFIELD=<STRING_GREATER_THAN_4000>
Result: Data deleted (CLOBFIELD=null)


I am also using .NET driver and it works!


Regards,
dvd
Back to top
View user's profile Send private message
bork
Devart Team


Joined: 12 Mar 2010
Posts: 467

PostPosted: Thu 15 Jul 2010 09:39    Post subject: Reply with quote

Hello

You can insert CLOB data by the following code:
Code:
var
  i: integer;
  str: string;
begin
  for i := 0 to 19999 do
    str := str + Char(RandomRange(byte('a'), byte('z')));

  SQLQuery1.SQL.Text := 'insert into btest6 (id, name, myclob) values (10, ''test clob'', EMPTY_CLOB()) ' + #13 +
                        'RETURNING ' + #13 +
                        '  myclob ' + #13 +
                        'INTO ' + #13 +
                        ' :myclob';

  SQLQuery1.ParamByName('myclob').ParamType := ptInput;
  SQLQuery1.ParamByName('myclob').DataType := ftOraClob;
  SQLQuery1.ParamByName('myclob').Value := str;

  SQLQuery1.ExecSQL;
end;


The DDL script for creating this table:
Code:
CREATE TABLE TEST_CLOB (
  ID NUMBER,
  NAME VARCHAR2(50),
  MYCLOB CLOB,
  CONSTRAINT PK_TEST_CLOB PRIMARY KEY (ID)
)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Devart Forum Index -> dbExpress driver for Oracle All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum