====== pears.iqmoneyround ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create function "pears"."iqmoneyround"(
/* Application Maintained Function / Procedure - DO NOT EDIT*/
in "val" numeric )
returns numeric
begin
declare "c" numeric;
declare "neg" tinyint;
set "neg" = 0;
if "val" < 0 then
set "neg" = 1
end if;
set "c" = ("truncate"("abs"("val"*1000)+.5,0)/1000);
if "neg" = 1 then
set "c" = 0-"c"
end if;
set "neg" = 0;
if "c" < 0 then
set "neg" = 1
end if;
set "c" = "truncate"("abs"("c"*100)+.5,0)/100;
if "neg" = 1 then
set "c" = 0-"c"
end if;
return "c"
end