support for ROUND(double precision, integer) as numeric

27 views
Skip to first unread message

PAscal L

unread,
May 4, 2016, 3:58:19 PM5/4/16
to Better Oracle functions support
Hello,

It seems that ROUND(double precision, integer) is not supported in PostgreSQL.

But it is supported in Oracle:

ROUND(n, integer)

ROUND returns n rounded to integer places to the right of the decimal point. If you omit integer, then n is rounded to 0 places. The argument integer can be negative to round off digits left of the decimal point.

n can be any numeric datatype or any nonnumeric datatype that can be implicitly converted to a numeric datatype. The argument integer must be an integer. If you omit integer, then the function returns the same datatype as the numeric datatype of the argument. If you include integer, then the function returns NUMBER.



This also applyes to TRUNC(double precision, integer)

Here are the founctions that could be added to solve this issue:

CREATE or REPLACE FUNCTION oracle.round(double precision, int)
RETURNS numeric
AS $$SELECT pg_catalog.round($1::numeric, $2)$$
LANGUAGE sql;

CREATE or REPLACE FUNCTION oracle.trunc(double precision, int)
RETURNS numeric
AS $$SELECT pg_catalog.trunc($1::numeric, $2)$$
LANGUAGE sql;

Pavel Stehule

unread,
May 4, 2016, 11:24:50 PM5/4/16
to orafce-...@googlegroups.com
please, can you do github pull request ? https://github.com/orafce/orafce

Thank you

Pavel
 

--
You received this message because you are subscribed to the Google Groups "Better Oracle functions support" group.
To post to this group, send email to orafce-...@googlegroups.com.
Visit this group at https://groups.google.com/group/orafce-general.

PAscal L

unread,
May 5, 2016, 3:44:45 AM5/5/16
to Better Oracle functions support

Pull request #44 created

Pavel Stehule

unread,
May 5, 2016, 4:07:37 AM5/5/16
to orafce-...@googlegroups.com


2016-05-05 9:44 GMT+02:00 PAscal L <legrand...@hotmail.com>:

Pull request #44 created

This is a issue, not pull request. But it is not problem :)

Pul request is "patch"

Regards

Pavel Stehule

unread,
May 21, 2016, 4:17:10 AM5/21/16
to orafce-...@googlegroups.com
This work is  done

PAscal L

unread,
May 21, 2016, 1:41:11 PM5/21/16
to Better Oracle functions support
Tank you !
Reply all
Reply to author
Forward
0 new messages