Data truncates without warning.

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
MarkF
Posts: 211
Joined: Thu 02 Mar 2006 14:55

Data truncates without warning.

Post by MarkF » Thu 18 Jan 2007 19:46

Hi!

I'm using a TSmartQuery on a varchar2(10) field. If I go:

SQuery.RecNo := RecordNumber;
SQuery.Edit();
SQuery.Fields[0].AsString := 'THIS WILL NOT FIT'; // Note that the field is varchar2(10)
SQuery.Post;

The data truncates without warning me. I'd expect to get an ORA-12899 "Value too large for column" error. Is there any way to enable this to happen? Perhaps I'm just missing an option? Using ODAC 5.80.0.39 on D2006. Thanks for any help!

-Mark Ford

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Mon 22 Jan 2007 11:36

This is behaviour of the TStringField class. When you assign a value to a field, this value is truncated to field size with no exception.
If you want exception to be generated, you should use separate TOraQuery or TOraSQL component to update a table and assign values through parameters.

Post Reply