У меня есть таблицы с emp1 и emp2
emp1:
emp_1 | emp_2
1 | 2
3 | 4
5 | 6
emp2:
emp
1
2
3
6
Я попытался установить первичный ключ для таблицы emp1 и внешний ключ для emp2.
Мой код:
Для первичного ключа:
alter table emp1 add primary key(emp_1,emp_2);
Для внешнего ключа:
alter table emp2
add foreign key (emp)
references a_t1(emp_1,emp_2);
Ошибка:
Error report -
SQL Error: ORA-02256: number of referencing columns must match referenced columns
02256. 00000 - "number of referencing columns must match referenced columns"
*Cause: The number of columns in the foreign-key referencing list is not
equal to the number of columns in the referenced list.
*Action: Make sure that the referencing columns match the referenced
columns.
Пожалуйста, помогите мне решить эту ошибку и установить первичный ключ.