关于 SQL 语句中缺少左括号的混淆错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10197640/
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
Confusing error about missing left parenthesis in SQL statement
提问by fenerlitk
SQLPLUS says I have missing left parenthesis with this statement in my sql script..
SQLPLUS 说我的 sql 脚本中缺少此语句的左括号。
CREATE TABLE people(
id INT NOT NULL PRIMARY KEY,
name VARCHAR2
);
I had uploaded my script with sftp, could that have played around with the script?
我已经用 sftp 上传了我的脚本,那可以玩脚本吗?
回答by Sam DeHaan
VARCHAR2 is a type that needs a maximum size/length. Try something like...
VARCHAR2 是一种需要最大大小/长度的类型。尝试类似...
varchar2(50)
Your missing left parenthesis is the parenthesis that surrounds the size.
您缺少的左括号是围绕大小的括号。
CREATE TABLE people(
id INT NOT NULL PRIMARY KEY,
name VARCHAR2(50)
);
回答by Ollie
You need to specify a size for the VARCHAR2 data type.
您需要为 VARCHAR2 数据类型指定大小。
E.g. VARCHAR2(30)
例如 VARCHAR2(30)
SQL*Plus is looking for the brackets around the VARCHAR2 size definition.
SQL*Plus 正在寻找围绕 VARCHAR2 大小定义的括号。
回答by Rashid Jorvee
You are getting this error because you didn't specify the character with datatype varchar2. Try something like this:
您收到此错误是因为您没有指定数据类型为 varchar2 的字符。尝试这样的事情:
CREATE TABLE people(
id INT NOT NULL PRIMARY KEY,
name VARCHAR2(20) );
回答by Rahul Kumar Singh
You need to specify the size of Varchar2
.
您需要指定Varchar2
.
For example:- Name Varchar2(50)
例如:- Name Varchar2(50)
Note:- The maximum size of the Varchar2 is 4000.
注意:- Varchar2 的最大大小为 4000。