[pgsql-jp: 32658] Re: numeric型の計算

shunji sijam shunji @ sijam.com
2004年 4月 5日 (月) 15:31:08 JST


楠元です。

金額::double precision / 1.05
でいかがでしょう?

ちがってたらごめんなさい。



> -----Original Message-----
> From: pgsql-jp-admin @ ml.postgresql.jp
> [mailto:pgsql-jp-admin @ ml.postgresql.jp]On Behalf Of 西村 篤史
> Sent: Monday, April 05, 2004 1:58 PM
> To: pgsql
> Subject: [pgsql-jp: 32657] numeric型の計算
>
>
> 西村@和歌山市です。こんにちは。
>
> 非常に初歩的なFAQ かも知れませんが、教えてください。
>
> PostgreSQL 7.2.1 にて、以下のテーブルを作りました。
>
> create table T_実績 (
>   ID_NUM       serial unique primary key ,
>   日付         timestamp ,
>   店舗         varchar(5) ,
>   CODE       varchar(13) ,
>   個数         numeric(12,2) ,
>   金額         numeric(12,2) ,
>   部門CD       int
> );
>
> このテーブルを使って、金額 / 1.05 を計算するクエリを実行するのですが、
> ERROR:  Unable to identify an operator '/' for types 'numeric'
> and 'double precision'
> 	You will have to retype this query using an explicit cast
>
> とエラーがでます。
> 割り算してる所をどのような型へキャストすればいいのでしょうか?
>
> ご教授の程、宜しくお願いいたします。
>
> --
>  ATSUSHI Nishimura <atsushi_nishimura @ lets-heart.co.jp>
>
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.648 / Virus Database: 415 - Release Date: 16/03/31
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.648 / Virus Database: 415 - Release Date: 16/03/31




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