引言 Andrew Sullivan <andrew@libertyrms.info>:
> On Mon, Mar 11, 2002 at 11:45:07AM +0800, Edmund Lim Chi Chung wrote:
> >
> > CREATE TABLE testdecimal ( decimal_value DECIMAL(6,2));
> > INSERT INTO testdecimal VALUES(1.0);
> > INSERT INTO testdecimal VALUES(1.1);
> > SELECT * FROM testdecimal WHERE decimal_value = 1.0;
> >
> > Error : Unable to identify an operator '=' for types 'numeric' and
> 'double
> > precision'
> > You will have to retype this query using and explicit cast
>
> You'll need to recast, like it says. Try
>
> SELECT * FROM testdecimal WHERE decimal_value = 1.0::decimal;
>
> A
>
> --
> ----
> Andrew Sullivan 87 Mowat Avenue
> Liberty RMS Toronto, Ontario Canada
> <andrew@libertyrms.info> M6K 3E3
> +1 416 646 3304 x110
>
>
Found two more method:
SELECT * FROM testdecimal WHERE decimal_value = '1.0';
SELECT * FROM testdecimal WHERE decimal_value = CAST( 1.0 AS decimal );