jpadkins49
asked on
PostgreSQL Rounding
All,
I am in the process of creating a trigger in a PostgreSQL database. I need to round the decimal number to the nearest quarter. For instance, 14.68 would be rounded to 14.75. We have a time and attendance system that round items to time and a half. The problem is that when it rounds the total time calculated for overtime it rounds it to an odd decimal such as 14.68. Our company policies dictate that these items be rounded to the nearest quarter of a decimal. The easiest way to do this is on the database end rather than editing the source code of the project. I need a PostgreSQL function that rounds the numbers past the decimal to the nearest .25. Any help would be greatly appreciated.
I am in the process of creating a trigger in a PostgreSQL database. I need to round the decimal number to the nearest quarter. For instance, 14.68 would be rounded to 14.75. We have a time and attendance system that round items to time and a half. The problem is that when it rounds the total time calculated for overtime it rounds it to an odd decimal such as 14.68. Our company policies dictate that these items be rounded to the nearest quarter of a decimal. The easiest way to do this is on the database end rather than editing the source code of the project. I need a PostgreSQL function that rounds the numbers past the decimal to the nearest .25. Any help would be greatly appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
update accrual_balance set balance = cast(round((balance/60)/15
Let me know if there is an easier way.
Thanks