0
私はテーブルchapterassociation
内rgn_no
とchp_cd
の値にテーブルbue
内rgn_no
とchp_cd
の値を更新するクエリを作成しようとしています。私は、WHERE句が問題だとは思わないが、私はそれを実行すると、私は次のエラーを取得しています:PostgreSQLデータベース - エラー・アシスタンス
SQLエラー:
ERROR: insert or update on table "bue" violates foreign key constraint "bue_chp_cd_fkey"
DETAIL: Key (chp_cd)=(CA3) is not present in table "chapter".
どのような援助が大幅に高く評価されます!
SQLクエリ:
ERROR: insert or update on table "bue" violates foreign key constraint
"bue_chp_cd_fkey" DETAIL: Key (chp_cd)=(CA3) is not present in table "chapter".
それはあなたの更新プログラムの一つが 'CA3' にchp_cdを設定したいが、それCA3が許容値ではないことを言う:
UPDATE bue SET
rgn_no = chapterassociation.rgn_no,
chp_cd = chapterassociation.chp_cd
FROM
chapterassociation
WHERE
bue.mbr_no IS NULL AND bue.chp_cd IS NULL
AND bue.work_state = chapterassociation.work_state
AND bue.bgu_cd = chapterassociation.bgu_cd
ありがとうございます!私の愚かな間違いで申し訳ありません! – user1364769