-2
我使用的是Oracle 11g r2 Express Edition和SQL命令行。我遇到問題時,我更新主鍵的外鍵沒有更新。有沒有解決方法?外鍵沒有在oracle中使用主鍵更新
這是命令我的2臺
CREATE TABLE staff(staff_id number(5) not null primary key);
CREATE TABLE customer(customer_id number(5) not null primary key,staff_id number(5) not null references staff);
我不確定我是否理解您期望看到的行爲。主鍵應該是非易失性的(不變的)。外鍵不會執行級聯更新。你可以這樣做來實現級聯更新http://tkyte.blogspot.com/2009/10/httpasktomoraclecomtkyteupdatecascade.html,但這通常是你應該避免通過使主鍵非易失性開始。 –