2016-04-22 109 views
1

我試圖創建一個約束來確保列是不同的值,但在timesheet_approved行上不斷收到錯誤。oracle缺少右括號(第7行)

create table Funtom_timesheet 
(
timesheet_ID   number(3) constraint timesheet_pk primary key, 
timesheet_Emp   number(3) constraint timesheet_Emp not null references funtom_employee, 
timesheet_Wc   date  constraint timesheet_Wc not null, 
timesheet_OT   number(2) default 0, 
timesheet_Approved number(3) constraint timesheet_approved_uc unique(timesheet_Approved,timesheet_Emp) constraint timesheet_approved references funtom_employee 
) 
; 
+0

檢查在[Techonthenet](創建表語法http://www.techonthenet.com/oracle/tables/create_table.php ),[docs.oracle.com](http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_7002.htm) – Spidey

回答

0

我認爲多列約束不是列定義的一部分。試戴分離出:

create table Funtom_timesheet (
    timesheet_ID   number(3) constraint timesheet_pk primary key, 
    timesheet_Emp   number(3) constraint timesheet_Emp not null references funtom_employee(??), 
-------------------------------------------------------------------------------------------------------^ 
    timesheet_Wc   date  constraint timesheet_Wc not null, 
    timesheet_OT   number(2) default 0, 
    timesheet_Approved number(3), 
    constraint timesheet_approved_uc unique(timesheet_Approved,timesheet_Emp), 
    constraint timesheet_approved references funtom_employee(??) 
-------------------------------------------------------------^ 
); 

和列填寫引用

+0

已經擺脫了最初的錯誤,但現在我有一個錯誤說未知的命令」)」 –