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

?



LVL 50
LowfatspreadAsked:
Who is Participating?
 
ghp7000Connect With a Mentor Commented:
either define the column as decimal 6,3, no truncation will take place or yes, use the round function, but why would you want to round the decimal number if it has a precision of 3?
Usually, rounding takes place in the select statement, not in the insert
0
 
LowfatspreadAuthor Commented:
thanks ghp7000

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
0
 
ghp7000Commented:
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?
0
All Courses

From novice to tech pro — start learning today.