I notice when the SQL contains function Round, it gives an error :
Exception Class EIBCError error with message :
"Dynamic SQL error expression evaluation not supported Invalid Data Type for Division in SQL 3".
The same code without Round, gives correct result.
Any Idea ?
Thx
Code: Select all
procedure TfrmAccueil.Operer(Trans:TIBCTransaction; C:TIBCConnection);
var MyQuery:TIBCSQL;
begin
MyQuery:=TIBCSQL.Create(NIL);
try
//==========================================================
MyQuery.Connection:=C;
MyQuery.Transaction:=Trans;
MyQuery.AutoCommit:=False;
MyQuery.SQL.Clear;
MyQuery.SQL.Add('Update MyTable Set');
MyQuery.SQL.Add('FieldA = Round(FieldB / :P)'); // FieldA : integer FieldB : Double Precision
MyQuery.SQL.Add('Where (ID = :ID)');
if not MyQuery.Prepared then MyQuery.Prepare;
With MyQuery do
begin
ParamByName('ID').DataType:=ftinteger;
ParamByName('ID').AsInteger:=1;
ParamByName('P').DataType:=ftFloat;
ParamByName('P').AsFloat:=10;
end;
MyQuery.Execute;
//==========================================================
finally
MyQuery.Free;
end;
end;
IBDAC : ibdac_7.4.1_d27std
Firebird-2.5.9.27139_0_Win32