[pgsql-jp: 33669] Re: numericなデータの演算

Mashiki mashiki @ yanah.com
2004年 7月 15日 (木) 00:19:54 JST


 Mashikiです。

>numeric(14,3)のフィールドに掛け算をして、結果を同じ numeric(14,3)で
>受け取りたいのですが、うまく行きません。
>
>"orosine numeric(14,3)" というフィールドを作って
>SELECT orosine * 1.067 FROM hoge;
>とすると
>ERROR:  Unable to identify an operator '*' for types 'numeric' and 'float8'
>        You will have to retype this query using an explicit cast
>と怒られるので float8 などでキャストすると一応、答えは得られました。
>float8 などではなく、numeric(14,3) で受け取る方法などはあるのでしょうか?

お使いのバージョンは7.4.xなんですよね。

 SELECT (orosine * 1.067::numeric)::numeric(14,3) FROM hoge;

とか、してみたら。



pgsql-jp メーリングリストの案内