set list on;
set sql dialect 1;
shell del C:\FBTESTING\qa\misc\tmp4test.fdb 2>nul;
create database 'localhost:C:\FBTESTING\qa\misc\tmp4test.fdb';
select mon$sql_dialect from mon$database;
commit;
recreate table test(id int primary key, x numeric(9,2), y numeric(9,2));
insert into test(id, x, y) select row_number()over(), 1.11, 333.33 from rdb$types,rdb$types rows 1000;
commit;
set term ^;
create or alter function fn_sum returns double precision as
begin
return ( select sum(x/y) from test );
end
^
create or alter package pg as
begin
function pg_sum returns double precision;
end
^
recreate package body pg as
begin
function pg_sum returns double precision as
begin
return ( select sum(x/y) from test );
end
end
^
set term ;^
commit;
select fn_sum(), pg.pg_sum() from rdb$database;
MON$SQL_DIALECT 1
FN_SUM 3.330033300333080
PG_SUM 3.300000000000000
If we change in script set sql dialect to 3 then out put will contain same values (3.300000000000000).
No matter whether some value proper or no, but result must be the same for PSQL unit regardless is it standalone or packaged.
Consider script:
Its result will be:
If we change in script set sql dialect to 3 then out put will contain same values (3.300000000000000).
No matter whether some value proper or no, but result must be the same for PSQL unit regardless is it standalone or packaged.