oracle ORA-00906: 缺少左括号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22063030/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 05:31:32  来源:igfitidea点击:

ORA-00906: missing left parenthesis

oracle

提问by Tushar

create table widep(
 cac NUMBER,
 ddate DATE,
 dtime TIMESTAMP,
 type VARCHAR2,
 amount NUMBER(10,2),
 constraint qwe foreign key(cac) references cust(cac)
)

回答by Andreas Fester

The completeerror message states Error at CommandLine:5 Column:15which is this location:

完整的错误消息,美国Error at CommandLine:5 Column:15是这个位置:

type VARCHAR2,
            ^^^

VARCHAR2requires a size parameter to define the maximum number of characters. Use something like

VARCHAR2需要一个 size 参数来定义最大字符数。使用类似的东西

create table widep(
 cac NUMBER,
 ddate DATE,
 dtime TIMESTAMP,
 type VARCHAR2(100),
 amount NUMBER(10,2),
 constraint qwe foreign key(cac) references cust(cac)
);

回答by Madushanka Milan

CREATE TABLE widep(
cac NUMBER(10,2) not null,
date DATE,
dtime TIMESTAMP,
type VARCHAR2(50),
amount NUMBER(10,2),
CONSTRAINT cac_fk FOREIGN KEY key(cac) REFERENCES cust(cac)
);