スカイ・エス・エイッチ

menu

ORCAレセコンをご利用中のお客様

TOP > ORCA よくある質問・回答集 > SargeにPostgreSQLのデータが移らない

よくある質問・回答集

SargeにPostgreSQLのデータが移らない


SargeのPostgreSQL(バージョン7.4.7)にデータを移そうとしたら、次のようなエラーが出て移すことができません。
value too long for type character varying(850)・・・・・

薬事日報社のCD-ROMから薬剤情報を入れましたか?
WoodyのPostgreSQL(バージョン7.2.1)はcharacter varying(n)のnより長い文字列でもエラーにならず入ってしまうことからこのようなことが起こります。
対応策
バックアップを取ってから
$ sudo -u orca psql orca
注意事項を変更しても良い薬剤か確認を取る(1行で)
orca=> select tbl_yakujyo.srycd,tbl_tensu.name,character_length(caution) from tbl_yakujyo,tbl_tensu where character_length(caution)>425 and tbl_tensu.srycd=tbl_yakujyo.srycd and tbl_tensu.yukostymd<='20060521' and tbl_tensu.yukoedymd>=’20060521′;
850byteを超える場合850byteに
orca=> update tbl_yakujyo set caution = substring(caution,1,425) where character_length(caution)425;
おしまい
orca=> \q
これ以降7.4.7環境に移す

test