on 11-27-2015 3:20 PM
Dear Experts,
Can somebody help me understand why
SELECT TO_DECIMAL(42242.640972,15,15) "to decimal" FROM DUMMY;
does not work and throws numeric over flow exception.
Thank you for your time
Kind Regards,
Ajaz
Dear Lars, Dear Mert,
Thank you for your reply. I will try with some examples and understand how it works.
Kind Regards,
Ajaz
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Floating point numbers are not a particularly intuitive concept in general.
So it might be useful to get familiar with them on a broader basis, e.g.:
The Floating-Point Guide - What Every Programmer Should Know About Floating-Point Arithmetic
and of course
https://ece.uwaterloo.ca/~dwharder/NumericalAnalysis/02Numerics/Double/paper.pdf
You need to add more to the second set of digits for the space. Imagine 1st set of digits as the total digits and second set is the part after the fraction there. So in your case you defined 15,15. As Lars said, you have not left any for the numbers before the fraction. Try 20,15, it works fine.
SELECT TO_DECIMAL(42242.640972,20,15) "to decimal" FROM DUMMY;
Even 19 works but not sure why?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You specified to have all 15 digits reserved for the fractional part but the value you try to convert here does have 5 digits before "the dot'. That's why you get the error message.
See Data Types - SAP HANA SQL and System Views Reference - SAP Library on how DECIMAL data types work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.