Re: Filled dataset decimal value not same as fetched value?

From: Tom Markham (TomMarkham_at_discussions.microsoft.com)
Date: 03/16/05


Date: Wed, 16 Mar 2005 05:09:12 -0800

Hi Val,

I believe you misunderstood my problem. Maybe this will help. I am using
Microsoft's .NET Data Provider for Oracle. I instantiated a dataset, then I
executed the following query:

"SELECT 8.1 as NUM1, 8.12 as NUM2, 8.123 as NUM3, 8.1234 as NUM4, 8.12345 as
NUM5, 8.123456 as NUM6, 8.1234567 as NUM7, 8.12345678 as NUM8 FROM DUAL"

I filled my dataset with the query above. Then, I created a new DataRow
object for the dataset above and manually added the follow values to the new
datarow.

8.1
8.12
8.123
8.1234
8.12345
8.123456
8.1234567
8.12345678

Then I added the new row to the dataset.

Finally I iterated through the ItemArray of each datarow in the dataset,
getting each value and sending the output to the debug window.

It's quite astonishing actually. You should try it. What I end up with is
the following:

For the values filled from the query, all values with a odd number of
decimal places get an extra zero padded to them. The values with an even
number of decimal places are left alone.

For the values I entered manually, they are just as I would expect them to
be... the way I entered them.

So, you see, the problem isn't as cut and dry as rounding and/or
truncating... I would have been able to solve that on my own.

Any suggestions?

"Val Mazur (MVP)" wrote:

> Hi Tom,
>
> I believe rounding and truncating are totally different things. Even if you
> rounded number, it does not mean zeros will be truncated from the end. I do
> not know what Oracle has to manipulate datatypes, but if it has possibility
> to convert to decimal value with different precision, then this is what you
> need to remove this zero
>
> --
> Val Mazur
> Microsoft MVP
>
> http://xport.mvps.org
>
>
>
> "Tom Markham" <TomMarkham@discussions.microsoft.com> wrote in message
> news:F3F57C90-0571-4BA9-9D57-A77685E23E33@microsoft.com...
> > When I query my Oracle database for a decimal value, I explicitly specify
> > a
> > ROUND to one decimal place. When the value is filled into the dataset, the
> > value is stored with two decimal places. For instance, if the value I am
> > querying (and rounding in the SQL statement itself) is 8.5, the actual
> > value
> > in the dataset is 8.50.
> >
> > Now, I'm not going to argue that 8.5 is the same value as 8.50, but when
> > that 8.50 value is displayed in a grid... it is displayed as 8.50. This is
> > not good when I have validation code checking to make sure then user
> > didn't
> > enter a value with more than one decimal point.
> >
> > Note, I am not looking for a workaround to this issue. I would like to
> > solve
> > the problem at the source. I would like the value filled in the dataset to
> > be
> > the value retrieved from the database.
> >
> > What is really odd is that if the user types in 8.5 directly, the dataset
> > stores the value as 8.5. It isn't until the value is retrieved back from
> > the
> > database that it gets stored as 8.50.
>
>
>



Relevant Pages

  • Re: Filled dataset decimal value not same as fetched value?
    ... > I filled my dataset with the query above. ... I created a new DataRow ... > decimal places get an extra zero padded to them. ... >> I believe rounding and truncating are totally different things. ...
    (microsoft.public.dotnet.framework.adonet)
  • Summary : oracle rac and ssm-threshold
    ... not set to zero as stated in the Oracle documentation. ... I confirmed this with Oracle. ... we can run a query and it takes 1-2 secs to return the ... My first instinct would be that the clustered system is "not" production ...
    (Tru64-UNIX-Managers)
  • Re: Views - performance
    ... when u use stored object views oracle has to read the data dictionary ... this includes lots of steps for execution ... semantics of the query and fires it ... you'll possibly have any idea is to use explain plan to provide a base ...
    (comp.databases.oracle.server)
  • RE: DBI-1.48 bind_param_inout produces ORA-01461 colliding with a CLOB
    ... can pass strings as varchar's and have them inserted ... In theory I could write something to query the ... CLOB w/in Oracle is probably what is killing me... ...
    (perl.dbi.users)
  • Re: Equilevant of Oracle for optional records
    ... this query is done, then flatten the result? ... example, the Iqaluit Trauma: ... Oracle handles this data structure perfectly but I suspect it might be ...
    (microsoft.public.access.queries)