我经历了以前的答案,创建了一个伪外键来引用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