Storing Negative Numbers in Oracle? 
Author Message
 Storing Negative Numbers in Oracle?

Hi, I hope someone could help me. I've been trying to figure out how to
store this number "-118.245169" in a field called "LATITUDE". When
creating the table, I created the LATITUDE field by using the "number"
datatype like this: LATITUDE NUMBER(20,9), but it truncates, or actually
rounds off the number to: -118.2452 . I want to use this value in a
calculation, but I would like to store it without rounding it off. I'm
assuming that the negative number is causing it to round off.

Any help would be appreciated...

--Sussette



Sat, 11 Aug 2001 03:00:00 GMT
 Storing Negative Numbers in Oracle?

Sussette,

I've just tried this and I get back the correct result, but then I'm
using SQL*Navigator, and I think you are using SQL*Plus. I would
change your default numwidth value from 9 to 20.

SQL>show numwidth
numwidth 9
SQL>set numwidth 20
numwidth 20

You should get the correct result back now ;)

Chris.

Quote:

> Hi, I hope someone could help me. I've been trying to figure out how to
> store this number "-118.245169" in a field called "LATITUDE". When
> creating the table, I created the LATITUDE field by using the "number"
> datatype like this: LATITUDE NUMBER(20,9), but it truncates, or actually
> rounds off the number to: -118.2452 . I want to use this value in a
> calculation, but I would like to store it without rounding it off. I'm
> assuming that the negative number is causing it to round off.

> Any help would be appreciated...

> --Sussette



Sat, 11 Aug 2001 03:00:00 GMT
 Storing Negative Numbers in Oracle?
Chris: Thanks! You're a life saver! It works great.

--Sussette

Quote:

> Sussette,

> I've just tried this and I get back the correct result, but then I'm
> using SQL*Navigator, and I think you are using SQL*Plus. I would
> change your default numwidth value from 9 to 20.

> SQL>show numwidth
> numwidth 9
> SQL>set numwidth 20
> numwidth 20

> You should get the correct result back now ;)

> Chris.


> > Hi, I hope someone could help me. I've been trying to figure out how to
> > store this number "-118.245169" in a field called "LATITUDE". When
> > creating the table, I created the LATITUDE field by using the "number"
> > datatype like this: LATITUDE NUMBER(20,9), but it truncates, or actually
> > rounds off the number to: -118.2452 . I want to use this value in a
> > calculation, but I would like to store it without rounding it off. I'm
> > assuming that the negative number is causing it to round off.

> > Any help would be appreciated...

> > --Sussette



Sat, 11 Aug 2001 03:00:00 GMT
 Storing Negative Numbers in Oracle?
Hi Sussette,

If you using SQL*PLUS then check the numwith parameter.  Modify/Increase this
parameter and you should be able to see the correct results.

Hope this helps.

RBG



Wed, 15 Aug 2001 03:00:00 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. CONVERTING NEGATIVE NUMBERS TO POSITIVE NUMBERS

2. Negative Number displaying as Postivie Number

3. converting negative numbers into positive numbers

4. Problem with Oracle and Negative Numbers

5. Size reported as negative number -1446

6. Negative number

7. sp_spaceused with negative numbers?

8. Negative Number Device

9. Negative number in sp_spaceused

10. Negative number in Size field of Edit Database Device dialog

11. Negative Numbers appearing in DB Device Sizes - Why?

12. Meaning of negative number when changing size of a device


 
Powered by phpBB® Forum Software