在oracle中创建表时出错?

时间:2011-04-09 23:44:43

标签: sql oracle

使用以下命令创建表时出错:

Create table Sells
(Store_name varchar2(20) no null,
ISBN char(15) not null,
Unit_price number(3,2) not null,
Shipping_fee number(3,2) not null,
primary key(Store_name, ISBN),
foreign key (Store_name) references Bookstore(Name) on delete cascade,
check(Unit_price>0),
foreign key (ISBN) references Books(ISBN) on delete cascade;

它说:

ORA-00907:缺少右括号

无法弄清楚错误在哪里。 有人为这个错误提供了一些帮助吗?

2 个答案:

答案 0 :(得分:3)

create table sells
(
  store_name varchar2(20) not null, 
  isbn char(15) not null, 
  unit_price number(3,2) not null, 
  shipping_fee number(3,2) not null, 
  primary key(store_name, isbn),
  foreign key (store_name) 
    references book_store(name)
      on delete cascade, 
  check(unit_price>0),
  foreign key (isbn) 
    references books(isbn)
    on delete cascade
);

答案 1 :(得分:0)

创建表格销售 (Store_name varchar2(20) null, ISBN char(15)not null, Unit_price数字(3,2)不为空, Shipping_fee号码(3,2)不为空, 主键(Store_name,ISBN), 外键(Store_name)引用删除级联上的Bookstore(Name), 检查(UNIT_PRICE大于0), 外键(ISBN)参考书籍(ISBN)删除级联* *;