[pgsql-jp: 30864] Re: to_numberでFormat エラーになります

ISHIDA Akio iakio @ pjam.jpweb.net
2003年 8月 30日 (土) 16:41:52 JST


こんにちは。石田@苫小牧市です。

gotou wrote:
> ごとうです。
> 
> to_numberを使用して、指定した数値と比較して対象を絞り込む、
> というSQLなのですが、それが、実行時に
> 
> Bad numeric input format ' '
> 
> と言うエラーになってしまいます。

select to_number('', '99');

を実行しても、

ERROR:  Bad numeric input format ' '

というエラーになるようです。(7.3.2 ですが)。

> テストサーバ-------------------------------------------
> SELECT COUNT (customer_base_mst.cust_cd)
> FROM (customer_add_mst
> 		LEFT JOIN employ_mst
> 		ON customer_add_mst.employ_cd = employ_mst.employ_cd)
> 	RIGHT JOIN customer_base_mst
> 	ON customer_add_mst.cust_cd = customer_base_mst.cust_cd
> WHERE (
> 		(customer_base_mst.del_flg='0' Or customer_base_mst.del_flg Is Null)
> 	AND (customer_add_mst.del_flg='0' Or customer_add_mst.del_flg Is Null)
> 	AND (employ_mst.del_flg='0' Or employ_mst.del_flg Is Null)
> 	)
> AND (customer_base_mst.crt_cd='xxxxxxxxxxxxxxx')
> AND customer_base_mst.st_cd in ('xxxxx')
> AND (to_number(substr(birthday,5,2),'99') = 9 );

substr(birthday, 5, 2) が空白などを返さないかを調べて
みてはどうでしょうか?

--
ISHIDA Akio<iakio @ pjam.jpweb.net>





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