Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Insert -0 (minus zero) value ?

Yann39Oct 4 2011 — edited Oct 4 2011
Hi, we are using Oracle 10g r2.

We have a table ALL_COORDINATES with a column ALL_CORHGEO as NUMBER.
I saw in that table are stored some -0 values ! I thought it was impossible...
Values comes from a computation.

In an application, I need to show that numbers with a specific format, and with a variable number of decimal depending on the user preferences, so I use : (3 is the user preference)
to_number(to_char(all_corhgeo,'FM999G999G990D'||lpad('0',3,'0')))
but to_char fails when value is -0, returning ################.

Example :
SQL> select
  2   distinct(to_char(all_corhgeo,'FM999G999G990D'||lpad('0',3,'0'))) as "corhgeo",
  3   all_corhgeo,
  4   all_id
  5  from
  6   all_coordinates
  7  where
  8   all_id between 61840 and 61860
  9  order by
 10   all_corhgeo asc;

corhgeo          ALL_CORHGEO     ALL_ID
---------------- ----------- ----------
-0.000               -.0001       61857
-0.000               -.00003      61856
-0.000               -.00001      61855
################      -.0000      61848
################      -.0000      61842
################      -.0000      61858
################      -.0000      61847
0.000                 .00002      61843
0.000                 .00009      61844
0.000                 .0001       61852
0.000                 .00013      61851
Of course I can replace those 4 values manually. But I would like to understand how has it been possible to insert them.

Thanks.
This post has been answered by Hemant K Chitale on Oct 4 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 1 2011
Added on Oct 4 2011
27 comments
2,187 views