2014-05-03 84 views
1
create table dvds(
    dvdid number not null primary key, 
    dvdname varchar(60) not null, 
    numdisks number not null default 1, 
    yearrlsd date not null, 
    mtypeid varchar(4) not null, 
    stuid varchar(4) not null, 
    ratingid varchar(4) not null, 
    formid char(2) not null, 
    statid char(3) not null, 
    foreign key (mtypeid) references movietypes (mtypeid) 
) 

whrn我在Oracle上運行此命令時,它是給錯誤:SQL查詢默認

missing right parenthesis

但刪除默認情況下它後工作

+0

查閱本手冊:http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_7002.htm#SQLRF54369 –

回答

2

之前的默認值應該來約束(不爲空);

numdisks number default 1 not null, 

SQLfiddle

+0

+1。 。 。我沒有意識到Oracle有這個要求。其他數據庫更靈活。 –