Re: numeric data type - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: numeric data type
Date
Msg-id 20150922211126.GH295765@alvherre.pgsql
Whole thread Raw
In response to Re: numeric data type  (Juan Pablo L. <jpablolorenzetti@hotmail.com>)
Responses Re: numeric data type
List pgsql-general
Juan Pablo L. wrote:
> thank you for your answer, the function is declared as:
>
> FUNCTION wtt_discount_account(IN in_phonenumber varchar(20),IN in_balanceid integer,IN in_chgval numeric(10,2))
>
> i chose numeric because is supposed to be better for numbers/money operations, supposed to be exact,
> i would not want to loose precision because that is money, is there any other way which does not
> involve loosing precision ? thankS!!

What you need is to use PG_GETARG_NUMERIC, then, and use a Numeric *
variable rather than float8.

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-general by date:

Previous
From: Juan Pablo L.
Date:
Subject: Re: numeric data type
Next
From: Juan Pablo L.
Date:
Subject: Re: numeric data type