Lowfatspread
asked on
DB2 V7 MVS - Decimal Column Insertion Truncate or Round
The standard option for insertion to a decimal column is (appears) to be truncate
is there anyway to alter this to round?
e.g.
A Int
B Decimal(6,2)
insert into mytab (A,B)
Values (1,1.009)
results in A=1 , B=1.00
or do i need to specify
insert into mytab (A,B)
Values (1,round(1.009,2))
which does give A=1 , B=1.01
?
is there anyway to alter this to round?
e.g.
A Int
B Decimal(6,2)
insert into mytab (A,B)
Values (1,1.009)
results in A=1 , B=1.00
or do i need to specify
insert into mytab (A,B)
Values (1,round(1.009,2))
which does give A=1 , B=1.01
?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
not that im flogging a dead horse, but perhaps I misunderstood your question-if the input source has a precision of 3, then presumably the customer wants that level of precision (they input numbers into their excel spreadsheet using a precision of 3), so why would you want to change the value that would be displayed? or change the value that is inserted into the db? I"m thinking the only reason you would want to do this is perhaps because the form doesn't support a field that has a precision of 3, in which case you should have the form changed?
ASKER
unfortunately I'm working developer who are arms length from a package which
has some "wonderful" rules for data types etc...
there input source is from a business who rely on excell spreadsheets and don't
understand that a displayed value isn't necessarily the same as the value that gets
exported...
so there's politics involved...
i was just wondering if an option existed.
thx