How to make a foreign key on a different account
up vote
0
down vote
favorite
So I am currently using my account with username: ctxsys and a password
In this account I have table named archiv11
.
In another account named d5a11
with a password I have a table called fileLocation
and what I am trying to do to make a foreign key from my current account table to the location table.
create table archiv11(
id integer primary key,
fileName varchar2(50),
fileContent blob,
locationID integer,
CONSTRAINT archivFK FOREIGN KEY(locationID) REFERENCES d5a11.fileLocation(loc_ID)
);
I get the error the table fileLocation does not exsist.
Is this possible?
sql database oracle foreign-keys
add a comment |
up vote
0
down vote
favorite
So I am currently using my account with username: ctxsys and a password
In this account I have table named archiv11
.
In another account named d5a11
with a password I have a table called fileLocation
and what I am trying to do to make a foreign key from my current account table to the location table.
create table archiv11(
id integer primary key,
fileName varchar2(50),
fileContent blob,
locationID integer,
CONSTRAINT archivFK FOREIGN KEY(locationID) REFERENCES d5a11.fileLocation(loc_ID)
);
I get the error the table fileLocation does not exsist.
Is this possible?
sql database oracle foreign-keys
You need read access to the table in order to define a foreign key relationship to it.
– Gordon Linoff
yesterday
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
So I am currently using my account with username: ctxsys and a password
In this account I have table named archiv11
.
In another account named d5a11
with a password I have a table called fileLocation
and what I am trying to do to make a foreign key from my current account table to the location table.
create table archiv11(
id integer primary key,
fileName varchar2(50),
fileContent blob,
locationID integer,
CONSTRAINT archivFK FOREIGN KEY(locationID) REFERENCES d5a11.fileLocation(loc_ID)
);
I get the error the table fileLocation does not exsist.
Is this possible?
sql database oracle foreign-keys
So I am currently using my account with username: ctxsys and a password
In this account I have table named archiv11
.
In another account named d5a11
with a password I have a table called fileLocation
and what I am trying to do to make a foreign key from my current account table to the location table.
create table archiv11(
id integer primary key,
fileName varchar2(50),
fileContent blob,
locationID integer,
CONSTRAINT archivFK FOREIGN KEY(locationID) REFERENCES d5a11.fileLocation(loc_ID)
);
I get the error the table fileLocation does not exsist.
Is this possible?
sql database oracle foreign-keys
sql database oracle foreign-keys
asked yesterday
kokos123
759
759
You need read access to the table in order to define a foreign key relationship to it.
– Gordon Linoff
yesterday
add a comment |
You need read access to the table in order to define a foreign key relationship to it.
– Gordon Linoff
yesterday
You need read access to the table in order to define a foreign key relationship to it.
– Gordon Linoff
yesterday
You need read access to the table in order to define a foreign key relationship to it.
– Gordon Linoff
yesterday
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
accepted
No problem; owner of the referenced table has to grant REFERENCE
to another user, which has to precede referenced table name with its owner.
Here's an example: user MIKE
has a table whose ID
is to be referenced in SCOTT
's table
SQL> show user
USER is "MIKE"
SQL> create table mike_table (id number primary key);
Table created.
SQL> grant references on mike_table to scott;
Grant succeeded.
SQL> connect scott/tiger
Connected.
SQL> create table scott_table (id number primary key,
2 id_mike number constraint fk_scmi references mike.mike_table(id)
3 );
Table created.
SQL>
add a comment |
up vote
0
down vote
This should be possible. However you must permit it with
grant reference on d5a11.fileLocation to ctxsys;
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
No problem; owner of the referenced table has to grant REFERENCE
to another user, which has to precede referenced table name with its owner.
Here's an example: user MIKE
has a table whose ID
is to be referenced in SCOTT
's table
SQL> show user
USER is "MIKE"
SQL> create table mike_table (id number primary key);
Table created.
SQL> grant references on mike_table to scott;
Grant succeeded.
SQL> connect scott/tiger
Connected.
SQL> create table scott_table (id number primary key,
2 id_mike number constraint fk_scmi references mike.mike_table(id)
3 );
Table created.
SQL>
add a comment |
up vote
1
down vote
accepted
No problem; owner of the referenced table has to grant REFERENCE
to another user, which has to precede referenced table name with its owner.
Here's an example: user MIKE
has a table whose ID
is to be referenced in SCOTT
's table
SQL> show user
USER is "MIKE"
SQL> create table mike_table (id number primary key);
Table created.
SQL> grant references on mike_table to scott;
Grant succeeded.
SQL> connect scott/tiger
Connected.
SQL> create table scott_table (id number primary key,
2 id_mike number constraint fk_scmi references mike.mike_table(id)
3 );
Table created.
SQL>
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
No problem; owner of the referenced table has to grant REFERENCE
to another user, which has to precede referenced table name with its owner.
Here's an example: user MIKE
has a table whose ID
is to be referenced in SCOTT
's table
SQL> show user
USER is "MIKE"
SQL> create table mike_table (id number primary key);
Table created.
SQL> grant references on mike_table to scott;
Grant succeeded.
SQL> connect scott/tiger
Connected.
SQL> create table scott_table (id number primary key,
2 id_mike number constraint fk_scmi references mike.mike_table(id)
3 );
Table created.
SQL>
No problem; owner of the referenced table has to grant REFERENCE
to another user, which has to precede referenced table name with its owner.
Here's an example: user MIKE
has a table whose ID
is to be referenced in SCOTT
's table
SQL> show user
USER is "MIKE"
SQL> create table mike_table (id number primary key);
Table created.
SQL> grant references on mike_table to scott;
Grant succeeded.
SQL> connect scott/tiger
Connected.
SQL> create table scott_table (id number primary key,
2 id_mike number constraint fk_scmi references mike.mike_table(id)
3 );
Table created.
SQL>
answered yesterday
Littlefoot
18.1k51333
18.1k51333
add a comment |
add a comment |
up vote
0
down vote
This should be possible. However you must permit it with
grant reference on d5a11.fileLocation to ctxsys;
add a comment |
up vote
0
down vote
This should be possible. However you must permit it with
grant reference on d5a11.fileLocation to ctxsys;
add a comment |
up vote
0
down vote
up vote
0
down vote
This should be possible. However you must permit it with
grant reference on d5a11.fileLocation to ctxsys;
This should be possible. However you must permit it with
grant reference on d5a11.fileLocation to ctxsys;
answered yesterday
Wernfried Domscheit
23.4k42757
23.4k42757
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53401780%2fhow-to-make-a-foreign-key-on-a-different-account%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You need read access to the table in order to define a foreign key relationship to it.
– Gordon Linoff
yesterday