Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Query returns wrong results

Re: Query returns wrong results

From: Billy Verreynne <vslabs_at_onwe.co.za>
Date: Thu, 23 Jan 2003 12:56:23 +0000
Message-ID: <b0ohot$jqg$1@ctb-nnrp2.saix.net>


Steven wrote:

> I have a table with a number(15,4) column.
>
> If I query that table as follows:
>
> select * from mytable where number_column > 0
>
> If get the rows containing the 0 value !!!!!! I should not. When I look
> in sqlplus the number is really 0, the only way it does not display is
> when I do a select with greater then 1.
>
> I don't get it. does anyone know what's going on??

The actual value is likely something like 0.0001 or the display format uses the exponential notation and the front-end you're using has a grid/label display width that only displays the zero.

Try:
SELECT
  TO_CHAR(number_column,'9.0000')
FROM my_table
WHERE number_column > 0

You should now see the column value properly displayed. Be careful of how the client formats numeric displays. This type of problem can often happen, especially when the client software uses a fixed width grid display (often based on the length of the column label and not the length of the actual column itself). In the case of SQL*Plus, you need to check its formatting settings.

--
Billy
Received on Thu Jan 23 2003 - 06:56:23 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US