Page 1 of 1

TFloatField and number issue

Posted: Thu 05 Sep 2019 10:09
by simonemontigiani
Hi team,

we recently updated ODAC components from 10.3.9 to 11.0.1 in Delphi 10.3.2.

We encountered a problem updating the value of a NUMBER field through declared TFloatField in TOraQuery.

In a specific example, we execute a post using a DB aware component:
The value in the specific example is 81,21 but the value received by the database is 81,20999999999999.

The problem is that we have an ON BEFORE UPDATE trigger testing the equality of OLD and NEW values of the NUMBER field.
That decimal difference raises an error and blocks the UPDATE.

This problem was introduced in 10.4.10 or 11.0.1, the 10.3.9 doesn't have this issue.
We temporary downgraded to 10.3.9 waiting for the resolution.

Thank you!

Best regards,

Simone Montigiani
Generazione Informatica S.r.l.

Re: TFloatField and number issue

Posted: Fri 06 Sep 2019 10:39
by MaximG
Thank you for the information. Unfortunately, the provided description is not enough to reproduce the issue in our environment. Please compose and send a small project, executionn of which causes the issue. In addition, we need a information about the structure of tables (DDL-script) with which this application works. For your convenience, please use the e-support form https://www.devart.com/company/contactform.html

Re: TFloatField and number issue

Posted: Wed 16 Oct 2019 06:57
by InsLabRU
Hello!

We have the same problem with TFloatField in TOraQuery.
Simple example:

Code: Select all

procedure TfmMain.Button3Click(Sender: TObject);
var
  tmpOraSession: TOraSession;
  tmpOraQuery: TOraQuery;
begin
  tmpOraSession := TOraSession.Create(nil);
  try
    tmpOraSession.Options.UseUnicode := True;
    tmpOraSession.Options.UnicodeEnvironment := True;
    tmpOraSession.Options.Direct := True;
    tmpOraSession.Server := 'OraTest:1521:OraTest';
    tmpOraSession.LoginPrompt := False;
    tmpOraSession.UserName := 'xxxxx';
    tmpOraSession.Password := 'xxxxx';
    tmpOraSession.Connected := True;

    tmpOraQuery := TOraQuery.Create(nil);
    try
      tmpOraQuery.Session := tmpOraSession;
      tmpOraQuery.SQL.Text := 'begin raise_application_error(-20001, ''value = '' || :x); end;';
      tmpOraQuery.ParamByName('x').AsFloat := 81.21;
      tmpOraQuery.ExecSQL;
    finally
      tmpOraQuery.Free;
    end;
  finally
    tmpOraSession.Free;
  end;
end;
Using Delphi 10.3.2
With ODAC 10.3.8 result = 81.21
With ODAC 10.3.9 result = 81.21
With ODAC 10.4.10 result = 81,20999999999999
With ODAC 11.0.1 result = 81,20999999999999