-
Can primary key, foreign key cross schema? Why or why not?
For example: I have a table STUDENT under schema TEST with a primary key. And I have another table STUDENT1 under schema TEST1. Now I wanted to create a foreign key in table student1 reference test.student. Is this doable?
Thanks!
-
Hi,
There is no problem creating a foreign key contraint from one schema to another providing the required privileges are granted.
Regards
Jim
Oracle Certified Professional
"Build your reputation by helping other people build theirs."
"Sarcasm may be the lowest form of wit but its still funny"
Click HERE to vist my website!
-
I thought so too. But the truth is: after I test it, it did not work. The error message is ora-00942: the referenced table test.student does not exist. user test1 has dba privs.
-
Hi,
I think you may need to grant the privileges directly.
Regards
Jim
Oracle Certified Professional
"Build your reputation by helping other people build theirs."
"Sarcasm may be the lowest form of wit but its still funny"
Click HERE to vist my website!
-
What do you mean by 'grant the privileges directly'?
-
Hi,
Heres an example
Schema Test1 has table employess
Schema Test2 has table departments
grant references, select on test2.departments to test1;
then create the foreign key contraint from employess to departments.
Regards
Jim
Oracle Certified Professional
"Build your reputation by helping other people build theirs."
"Sarcasm may be the lowest form of wit but its still funny"
Click HERE to vist my website!
-
Thanks, Jovery!
After I grant the specific privs, it worked. The question is: why? Why dba privs does not work?
The second question is: Can primary key, foreign key constraint cross database? For example, using database link?
Why or why not?
Thanks a lot!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|