【问题标题】:oracle missing right parenthesis (Line 7)oracle 缺少右括号(第 7 行)
【发布时间】:2023-04-03 17:23:01
【问题描述】:

我试图创建一个约束以确保列是不同的值,但在 timesheet_approved 行上不断收到错误。

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 
)
;

【问题讨论】:

标签: sql oracle sqlplus


【解决方案1】:

我认为多列约束不是列定义的一部分。尝试将它们分开:

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(??)
-------------------------------------------------------------^
);

并填写参考资料栏

【讨论】:

  • 已经摆脱了最初的错误但是现在我有一个错误说unknowncommand")"
猜你喜欢
  • 2021-11-10
  • 2019-05-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-09-29
  • 1970-01-01
  • 2021-07-29
相关资源
最近更新 更多