Thread: Comparing different numeric data types

Comparing different numeric data types

From
Vicente Alabau Gonzalvo
Date:
I don't know if it's the right place for posting this thing.
Maybe sql list be better, but here it is.

It seems not to be possible to compare different numeric data types
such as numeric and double precision. I get this error:

Unable to identify an operator '<=' for types 'numeric' and 'double
precision'

Is it planned to do this comparissions in the future?

It's possible to make a cast but I don't like this approach.
It would be better if can be made transparently.


Re: Comparing different numeric data types

From
Andrew Sullivan
Date:
On Fri, Jan 31, 2003 at 01:21:54PM +0100, Vicente Alabau Gonzalvo wrote:
> I don't know if it's the right place for posting this thing.
> Maybe sql list be better, but here it is.
>
> It seems not to be possible to compare different numeric data types
> such as numeric and double precision. I get this error:
>
> Unable to identify an operator '<=' for types 'numeric' and 'double
> precision'
>
> Is it planned to do this comparissions in the future?
>
> It's possible to make a cast but I don't like this approach.
> It would be better if can be made transparently.

There have been reams of discussion about automatic coercion.  Have a
look through the archives.

One thing you might try is to put both values in single quotes.
They'll make it into the system as text, and the system will probably
pick a reasonably sane type for them at the time of comparison.

A

--
----
Andrew Sullivan                         204-4141 Yonge Street
Liberty RMS                           Toronto, Ontario Canada
<andrew@libertyrms.info>                              M2P 2A8
                                         +1 416 646 3304 x110


Re: Comparing different numeric data types

From
Vicente Alabau Gonzalvo
Date:
Thanks.
This works also for Oracle and I supose to work in other databases.