使用自动增量创建数据库 table 时出错

Error while creating database table with auto increment

我想在此处创建 table 并创建 auto increment,但出现错误。该数据库是一个 oracle 数据库。 SQL 如下所示。

CREATE TABLE Continents 
    ( 
      ConId   INT GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1) PRIMARY KEY, 
      Continent VARCHAR(25),
    );

只删除这部分

(START WITH 1, INCREMENT BY 1)

使用这个语法。

CREATE TABLE Continents 
    ( 
      ConId   INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, 
      Continent VARCHAR(25),
    );

ConId 的值将从 1(一)开始,并始终递增 1。

参考这个db<>fiddle
另请参考Oracle documentation1

The following statement creates a table t1 with an identity column id. The sequence generator will always assign increasing integer values to id, starting with 1.
CREATE TABLE t1 (id NUMBER GENERATED AS IDENTITY);

1SQL 语言参考 (Oracle 21c) - 创建 TABLE