Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

DB2 V7 MVS - Decimal Column Insertion Truncate or Round

Posted on 2004-10-25
3
Medium Priority
?
6,507 Views
Last Modified: 2011-09-20
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

?



0
Comment
Question by:Lowfatspread
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 13

Accepted Solution

by:
ghp7000 earned 200 total points
ID: 12412018
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
 
LVL 50

Author Comment

by:Lowfatspread
ID: 12432410
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
 
LVL 13

Expert Comment

by:ghp7000
ID: 12435399
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

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
Recursive SQL in UDB/LUW (you can use 'recursive' and 'SQL' in the same sentence) A growing number of database queries lend themselves to recursive solutions.  It's not always easy to spot when recursion is called for, especially for people una…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question