Trailing blanks from CHAR fields truncated

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
heidenbluth
Posts: 56
Joined: Mon 08 Nov 2004 19:01
Location: Germany

Trailing blanks from CHAR fields truncated

Post by heidenbluth » Thu 20 Apr 2006 06:50

Hello,

There is a bug with fixed char fields. Please create a table like
CREATE TABLE TEST (
ID NUMBER(9),
TXT CHAR(10));
and insert a value including trailing blanks,
INSERT INTO TEST(ID,TXT) VALUES( 1, 'ABCDE ');
COMMIT;
Now show the contents in a TOraQuery:
SELECT ID, TXT from TEST

Unfortunately, the trailing blanks are truncated. You see 'ABCDE' instead of 'ABCDE '.
Could this be fixed, please? If the column is defined as CHAR the length cannot vary.
Regards,
Holger
--
Delphi 2005 - VCL, Oracle 10g Release 2, both on Windows XP

Challenger
Devart Team
Posts: 925
Joined: Thu 17 Nov 2005 10:53

Post by Challenger » Thu 20 Apr 2006 08:51

You can set TrimFixedChar option of TOraQuery to False but you will get ABCDE and 5 spaces. So for storing such values it is better to use Varchar fields.

heidenbluth
Posts: 56
Joined: Mon 08 Nov 2004 19:01
Location: Germany

Post by heidenbluth » Thu 20 Apr 2006 19:12

Thank you, that helped me.
Regards,
Holger

Post Reply