我可以跨数据库创建外键吗? [英] Can I create Foreign Keys across Databases?

查看:405
本文介绍了我可以跨数据库创建外键吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有2个数据库-DB1& DB2.

We have 2 databases - DB1 & DB2.

我可以在DB1中创建一个与DB2中的一个表有关系的表吗? 换句话说,我可以从另一个数据库的表中获取外键吗?

Can I create a table in DB1 that has a relation with one of the tables in DB2? In other words, can I have a Foreign Key in my table from another database?

我用不同的用户连接到这些数据库. 有什么想法吗?

I connect to these databases with different users. Any ideas?

现在,我收到错误消息:

Right now, I receive the error:

ORA-00942:表或视图不存在

ORA-00942:Table or view does not exist

推荐答案

否,Oracle不允许您创建通过数据库链接引用表的外键约束.您将必须使用触发器来增强完整性.

No, Oracle does not allow you to create a foreign key constraint that references a table via a database link. You would have to use triggers to enforce the integrity.

这篇关于我可以跨数据库创建外键吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆