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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ghp7000Commented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
DB2

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.