我正在尝试创建一个Users表:
CREATE TABLE users
( user_id int(5) PRIMARY KEY,
username varchar(25) NOT NULL,
password varchar(30) NOT NULL
);
但我一直收到这个错误:
Error starting at line 1 in command:
CREATE TABLE users
( user_id int(5) PRIMARY KEY,
username varchar(25) NOT NULL,
password varchar(30) NOT NULL
)
Error at Command Line:2 Column:13
Error report:
SQL Error: ORA-00907: missing right parenthesis
00907. 00000 - "missing right parenthesis"
*Cause:
*Action:
有什么想法吗?
答案 0 :(得分:1)
尝试
CREATE TABLE users
( user_id int PRIMARY KEY,
username varchar(25) NOT NULL,
password varchar(30) NOT NULL
);
答案 1 :(得分:1)
不要尝试为整数类型设置精度:
CREATE TABLE users
( user_id int PRIMARY KEY,
username varchar(25) NOT NULL,
password varchar(30) NOT NULL
);
答案 2 :(得分:1)
看起来它与您的int(5)
数据类型规范有关。请参阅Oracle numerica data types。
尝试类似:
CREATE TABLE users
( user_id NUMBER PRIMARY KEY,
username varchar(25) NOT NULL,
password varchar(30) NOT NULL
);
答案 3 :(得分:1)
以下方法有效,但请注意,在命令末尾添加了PRIMARY KEY
约束
CREATE TABLE users(
user_id int NOT NULL,
username varchar(25) NOT NULL,
password varchar(30) NOT NULL,
PRIMARY KEY(user_id)
);
答案 4 :(得分:-1)
要创建表:
do {
let response = try JSONDecoder().decode(Root.self, from: data)
print(response.result.movies.map({"file: \($0.file), label: \($0.label)"}))
movies = response.result.movies
} catch {
print(error)
}