的Yii的文件說DO define foreign-key relationships in the database schema。
你可以試試下列表格嗎?警予應該能夠拿起兩個外鍵:
create table a (
id int not null primary key,
extraid int not null unique
);
create table b (
id references a(id),
notsamextraid references a(extraid)
);
編輯:要找出是否已經有兩個表之間的外鍵,你可以使用下面的查詢。這不是在這個星球上最漂亮的查詢,但隨後有複製和粘貼:-)
select t1.owner, t1.constraint_name, t1.constraint_type, t1.table_name, c1.column_name,
t2.owner, t2.constraint_name, t2.constraint_type, t2.table_name, c2.column_name
from all_constraints t1
join all_cons_columns c1
on t1.constraint_name=c1.constraint_name
and t1.owner=c1.owner
and t1.table_name=c1.table_name
join all_constraints t2
on t1.owner=t2.owner
and t1.r_constraint_name=t2.constraint_name
join all_cons_columns c2
on t2.constraint_name=c2.constraint_name
and t2.owner=c2.owner
and t2.table_name=c2.table_name
and c1.position=c2.position
where t1.constraint_type = 'R'
and t1.table_name in ('A','B');
我沒有權限改變表......我用的方式....在Yii框架中解決這個問題的一種方法? – sasori
如果表b和a之間有兩個外鍵約束,你可以問問設置表的人嗎? –
我可以問明天,但是沒有任何oracle命令可以用來在sql開發人員中運行,以瞭解是否有兩個關鍵約束條件? – sasori