3

你能解释一下我的错误是什么吗?

create table ABC.t1 (
    c1 NUMBER GENERATED ALWAYS as IDENTITY ( START with 1 INCREMENT by 1 ),
    c2 VARCHAR2(10)
    )

错误报告 - ORA-02000:缺少(关键字 02000。00000 -“缺少 %s 关键字”

在此处输入图像描述

4

1 回答 1

2

“作为身份生成”功能在 Oracle 12c 上或之后工作。

在 Oracle 12c 之前:

create table t1 (
    c1 NUMBER,
    c2 VARCHAR2(10)
    );

create sequence
   t1_seq
  increment by 1
  start with 1;

Insert into
   t1
values
   (t1_seq.nextval, 'ABC');

在 Oracle 12c 中或之后:

create table ABC.t1 (
    c1 NUMBER GENERATED ALWAYS as IDENTITY ( START with 1 INCREMENT by 1 ),
    c2 VARCHAR2(10)
    );

Insert into
   t1
values
   ('ABC');

因此,您的声明仅适用于 12c 或更高版本。

于 2018-10-19T06:06:08.897 回答