Hi,
4GL does not have a in-built function to support rounding of values. However, you may rely on SQL ROUND keyword to accomplish this.
Syntax:
ROUND(expression, rounding factor)
Examples:
SELECT order_num, ROUND(total_price) FROM items WHERE ROUND(total_price)=300.00;
SELECT ROUND(425.46), ROUND(total_price) FROM items;
How factor works:
ROUND (90536.8746, -2) = 90500.00
ROUND (90536.8746, 0) = 90537.00
ROUND (90536.8746, 2) = 90536.87
9 0 5 3 6 . 8 7 4 6
| | |
-2 ---------------- | |
0 -------------------- |
2 ------------------------
Cursor preparation Ex:
PREPARE round_id FROM "SELECT NVL(ROUND(?, ?),0) FROM systables WHERE tabid=1"
DECLARE round_cur CURSOR FOR round_id
FREE round_id
Execute Ex:
LET var1=125.62
LET var2=2
OPEN round_cur USING var1, var2
EXECUTE round_id INTO mval
Regards,
Shriyan
"No amount of careful planning will ever replace dumb luck."