【发布时间】:2019-06-27 05:06:10
【问题描述】:
Sql 开发者报错:
ORA-00907:缺少右括号,用于下一个表:
create table customer (
CUSTOMER_ID number identity (1,1) not null,
CUSTOMER_PHONE char(13) not null
);
还有'身份是红色下划线的,不知道为什么
【问题讨论】:
Sql 开发者报错:
ORA-00907:缺少右括号,用于下一个表:
create table customer (
CUSTOMER_ID number identity (1,1) not null,
CUSTOMER_PHONE char(13) not null
);
还有'身份是红色下划线的,不知道为什么
【问题讨论】:
Oracle 12c 及更高版本的正确语法:
create table customer (
CUSTOMER_ID NUMBER GENERATED ALWAYS AS IDENTITY,
CUSTOMER_PHONE char(13) not null
);
-- explicit start and increment
create table customer (
CUSTOMER_ID NUMBER GENERATED ALWAYS AS IDENTITY(START WITH 1 INCREMENT BY 1),
CUSTOMER_PHONE char(13) not null
);
【讨论】: