Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
CREATE FUNCTION "pears"."iqmoneynumeric"( /* 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