ORA-01406: fetched column value was truncated
Posted: Thu 27 Jul 2006 11:05
Hi all,
I just got a strange problem when I open a dataset that just contains some double values. For this special combination of values in the table, I get the above error message on Open() with both dbexpoda 2.50 and 3.00.
(Borland's dbexpora does not bring up the error although it fetches a complete mess, but that's another story.)
Can anyone please try to reproduce the problem in order to avoid a configuration problem on my side, and can anyone give me a hint how to avoid the error?
To reproduce, use a form with a TSQLConnection, a TSQLDataset, and a Label. Setup, creating the test table and querying is described in code below. When querying, indside Open() I get the exception.
Thans in advance.
miwi
I just got a strange problem when I open a dataset that just contains some double values. For this special combination of values in the table, I get the above error message on Open() with both dbexpoda 2.50 and 3.00.
(Borland's dbexpora does not bring up the error although it fetches a complete mess, but that's another story.)
Can anyone please try to reproduce the problem in order to avoid a configuration problem on my side, and can anyone give me a hint how to avoid the error?
To reproduce, use a form with a TSQLConnection, a TSQLDataset, and a Label. Setup, creating the test table and querying is described in code below. When querying, indside Open() I get the exception.
Code: Select all
procedure TForm1.Connect;
begin
SQLConnection1.DriverName := 'foobar';
SQLConnection1.GetDriverFunc := 'getSQLDriverORA';
SQLConnection1.LibraryName := 'dbexpoda.dll';
SQLConnection1.VendorLib := 'oci.dll';
SQLConnection1.Params.CommaText := 'database=yourdb,user_name=user,password=secret';
end;
procedure TForm1.CreateTable;
const
data: array[0..24] of Double = (
3.8121804695004, 3.81220901917724, 0.290935806125078, 3.81220901917724,
0.00920139858130051, 1.90610450958862, 0, 7.51498895111909E-42, 0, 0,
0, 0, 0, 0.00462496303100731, 0, 0, 0, 0, 0, 0, 0.00242810559169161, 0,
4.12770390730889E-21, 2.35868794703365E-21, 1.27053649198811
);
var
i: Integer;
begin
SQLConnection1.ExecuteDirect('drop table mw_test');
SQLConnection1.ExecuteDirect('create table mw_test (x float)');
SQLDataSet1.CommandText := 'insert into mw_test (x) values (:x)';
for i := 0 to High(data) do begin
SQLDataSet1.ParamByName('x').Value := data[i];
SQLDataSet1.ExecSQL;
end;
end;
procedure TForm1.QueryTable;
var
S: String;
begin
SQLDataSet1.CommandText := 'select * from mw_test';
SQLDataSet1.Open;
S := '';
while not SQLDataSet1.Eof do begin
S := S + SQLDataSet1.Fields[0].AsString + #13#10;
SQLDataSet1.Next;
end;
Label1.Caption := S;
end;
miwi