2016-04-22 104 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

已经摆脱了最初的错误,但现在我有一个错误说未知的命令”)” –