My requirement is I want to find the max of two negative decimals
for eg;
max(-89.62,-88.02) I want the output as -89.62
but I am getting 0 The output feils data type is decimal(10,2)
Can you please help me
MAx of two negative decimal
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 50
- Joined: Fri Dec 21, 2007 3:24 am
MAx of two negative decimal
balaji
-
- Participant
- Posts: 18
- Joined: Fri Jan 04, 2008 5:28 am
- Location: Bangalore
-
- Charter Member
- Posts: 299
- Joined: Wed Nov 13, 2002 5:38 pm
- Location: USA
I've never used this function and if I had a dime for all the times things "have to work" but didn't I wouldn't be sitting here writing this. I have, however, used the help button in Datastage.
To wit;
Max
I'm thinking decimals are not allowed for this function.
To wit;
Max
Code: Select all
Returns the greater of the two argument values
number 1 (int32) number 1 (int32)
result (int32)
Re: MAx of two negative decimal
As noted, the 'max' of those two values is -88.02 as -89.62 is less than -88.02.consulting wrote:My requirement is I want to find the max of two negative decimals
for eg;
max(-89.62,-88.02) I want the output as -89.62
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Remember back at school, when they taught you about the number line?
As Craig observed, -89.62 is less than -88.02. Therefore the Max() function is yielding the correct result.
You need to consider what you really want. It sounds like you want the number with the larger absolute value. (If you can be certain that both numbers are negative, this is - of course - given by the Min() function. Otherwise, something like Max(Abs(FirstNumber),Abs(SecondNumber)) is what you need.)
As Craig observed, -89.62 is less than -88.02. Therefore the Max() function is yielding the correct result.
You need to consider what you really want. It sounds like you want the number with the larger absolute value. (If you can be certain that both numbers are negative, this is - of course - given by the Min() function. Otherwise, something like Max(Abs(FirstNumber),Abs(SecondNumber)) is what you need.)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Charter Member
- Posts: 299
- Joined: Wed Nov 13, 2002 5:38 pm
- Location: USA