Subject | Firebird 3: formal declaration of ABS internal function, is it polymorphic? |
---|---|
Author | |
Post date | 2018-01-30T11:24Z |
For DB upgrade (from 1.5 to 3.0) I need to define custom internal function like this:
create or alter function F_ABS (
VAR_1 double precision)
returns integer
AS
declare variable result double precision;
begin
result = abs(var_1);
return result;
end
create or alter function F_ABS (
VAR_1 double precision)
returns integer
AS
declare variable result double precision;
begin
result = abs(var_1);
return result;
end
But I am confused. My experiments assert that ASB internal function is polymorphic - it returns BIGINT for BIGINT argument and DOUBLE PRECISION for DOUBLE PRECISION arguments, it can be tricky to determine the return type if string arguments is given (and implicit conversion occurs).
I would like that F_ABS has this polymorphic nature of ABS. How should I declare F_ABS to have this polymorphic nature?