Link to home
Start Free TrialLog in
Avatar of azharmateen
azharmateen

asked on

ORA-02270

dear friend

my master table is COMMON_SECTION in schema HRMS with columns
                            Section_id number(2);     Primary key
                            Section_name varchar2(35);

my child table is    FABRIC_ISSUE        in schema SMS with columns
                            Fabric_id number(7);      Primary Key
                            Fabric_name varchar2(35);
                            FROM_SECTION number(2);  "wana make it FK of section_id"

now i wanna make FROM_SECTION foreign key of Section_id which is a primary key in some other schema with a different name

it issues error ORA-02270: no matching unique or primary key for this column-list

i tried making synonyms of common_section into SMS schema where my child table is. same i tried making view but to no avail.

kinldy sooner gimme some solution
Avatar of MohanKNair
MohanKNair

Try this command

alter table SMS.FABRIC_ISSUE add constraint FABRIC_ISSUE_fk_frm_sect foreign key(FROM_SECTION) references HRMS.COMMON_SECTION(Section_id);

Avatar of azharmateen

ASKER

dear brother

usually this is the command that is used to add a foreign key between schamas and i had been using the same command with schema ref but it didnt help so i put the question on this site.

i have done it with some other way and i even share it with u. infact it was the problem of grants. i connected the schema of HRMS and wrote GRANT REFERENCES ON COMMON_SECTION TO SMS;

then i tried to make foreign key and it accepted.

anyways thanks

Azhar Mateen
ASKER CERTIFIED SOLUTION
Avatar of DarthMod
DarthMod
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial