Dear Experts,
I have the following situation.
I'm using some cursors with currency fields. The problem I get is currency overflow when the result of a multiplication exceeds the maximum currency or numeric value.
For example:
case 1:
** Using currency for calculations
CREATE CURSOR test (field1 y,field2 I)
INSERT INTO test(field1,field2) VALUES (123456789012345.6789,123456789)
SELECT IIF(field1*field2>922337203685477.5807,922337203685477.5807,field1*field2) as newfield;
from test;
INTO CURSOR new && CURRENCY VALUE OUT OF RANGE ERROR
case 2:
** Using numeric for calculations
CREATE CURSOR test (field1 n(16,4),field2 I)
INSERT INTO test(field1,field2) VALUES (123456789012345.6789,123456789)
SELECT IIF(field1*field2>999999999999999.9999,999999999999999.9999,field1*field2) as newfield;
from test;
INTO CURSOR new && NO ERRORS
The case I'm interested is case 1. Unfortunately I cannot use Numeric for all the calculations.
Can anyone help my solve this problem? (except from changing my fields to numeric)
Thanks In Advance,
Spyros
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only