[pgsql-jp: 30861] to_numberでFormatエラーになります
gotou
gotou @ hokkou.co.jp
2003年 8月 30日 (土) 16:16:10 JST
ごとうです。
to_numberを使用して、指定した数値と比較して対象を絞り込む、
というSQLなのですが、それが、実行時に
Bad numeric input format ' '
と言うエラーになってしまいます。
それで、今環境が二つありまして、会社のほうにテストサーバと、
データセンターのほうに、今実際に運用しているメインサーバがあります。
で、どちらもPostgreSQLのバージョンは、7.2.3なのですが、
同じSQLを実行したときに(引数は変わりますが)、テストサーバの方は
エラーにならないのですが、
メインサーバのほうで実行したときに、上記のエラーが出ます。
ありえないとは思いつつ、to_numberが使用できないのでは、と思い
テストしてみましたが、ちゃんと実行されました。
--------------------------------------
select to_number('00123456', '000000000000');
to_number
-----------
123456
--------------------------------------
どうにも原因がわからず、わらにもすがる思いです。
どうか、よろしくお願いします。
下記に、実行されるSQLを載せておきます。
メインサーバ(エラーが出ます)------------------------------
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 );
テストサーバ-------------------------------------------
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 );
pgsql-jp メーリングリストの案内