hello friends.
Create table form1 (empcid varchar2 (25), empshare varchar2 (10), empedoj date, constraint pkform1 primary key (empcid, empshare, empedoj));
create table sharecapital(loanid varchar2(25), loandt date,empshare varchar2(10),empedoj date, constraint fkform1 foreign key (empshare,empedoj) references form1);
I need to use only empshare and empedoj in sharecapital table. But shows
ORA-02256: number of referencing columns must match referenced columns
So kindly help me to solve this problem
thanks in advance
Loading
Raja KrishnamurthyPosted Mar 7, 2011, 2:42 PM
Ex.
what if the data is like this for Form1 table:
1 Share1 1/1/1980
2 Share1 1/1/1980
As shown above even though it is perfectly valid for the master table (Form1) it violates the primary key (deemed) for ShareCapital table since there are duplicates. The only way to fix this is to fix either your master table (include a surrogate key) or to include Empcid in ShareCapital.
Hope this helps.
Happy Programming!!!
Regards,
Raja
LOGANATHAN VPosted Mar 7, 2011, 1:31 PM
Suthish NairPosted Mar 7, 2011, 1:15 PM
loanid varchar2(25),
loandt date,
empshare varchar2(10),
empedoj date,
foreign key (empshare) references form1 (empshare) on delete cascade,
foreign key (empedoj) references form1 (empedoj) on delete cascade
);