我經歷了以前的答案,創建了一個僞外鍵來引用Netbeans 8.1中兩個數據庫之間的表。這是我想出了一個代碼,兩個數據庫之間的外鍵
DELIMITER //
CREATE OR REPLACE TRIGGER conf_track_FK
AFTER INSERT OR UPDATE on [email protected]
FOR EACH ROW
BEGIN
IF EXISTS(select * from inserted I where not exists (select * from
[email protected] A where I.conf_id=A.conf_id))
RAISE_APPLICATION_ERROR(-20001,'Violation of pseudo-foreign key.');
ROLLBACK;
END IF;
END;
/
不過,我遇到了以下錯誤:
PLS-00103: Encountered the symbol ";" when expecting one of the following:
) with and or group having intersect minus start union where
connect
PLS-00103: Encountered the symbol "ROLLBACK" when expecting one of the following:
:= . (% ;
The symbol ":=" was substituted for "ROLLBACK" to continue.
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
end not pragma final instantiable order overriding static
member constructor map
您的錯誤消息表明Oracle和'@ FIT5148B'是DBLink。您無法通過數據庫鏈接創建觸發器。您需要連接到遠程數據庫並在那裏創建觸發器。另外:對於我所知的任何Oracle SQL工具,''delimiter //'都是無效的。你確定你的工具支持嗎?此外,在Oracle中不存在「插入」這樣的事情 - 特別是不在行級觸發器中。 –
另外'if-statement'結構顯然是錯誤的。請先幫助自己並閱讀一些基本教程。他們不是很難[找](http://stackoverflow.com/tags/plsql/info)。 – user272735