各位大哥下面是我在oralce 数据库中出现的错误,找了很久没找出来。希望大哥们帮解决下 。oracle 数据库中运行:create table t(
       id varchar2(10) primary key,
       name varchar2(20)
)
create table tt(
       tt_id varchar2(20)  primary key
)
执行下面这条语句时报错:缺少关键字
alter table t add constraint  tt_fk_t 
foreign key (tt_id) reference tt(tt_id);

解决方案 »

  1.   


    --你是对T表id加外键约束
    alter table t add constraint tt_fk_t foreign key (id) reference tt(tt_id);
      

  2.   


    alter table t add constraint tt_fk_t foreign key (id) referencing tt(tt_id);
      

  3.   

    alter table t add constraints tt_fk_t foreign key (id) reference tt(tt_id);
      

  4.   


     alter table t  add constraint testsw1 foreign key (ID)
      references tt (TT_ID);