将 oracle 中的主键更改为 NUMBER GENERATED ALWAYS AS IDENTITY

Alter primary key in oracle to NUMBER GENERATED ALWAYS AS IDENTITY

oracle中可以修改主键标识吗 从 GENERATED BY DEFAULT ON NULL AS IDENTITY 始终作为身份生成

谢谢。

是; 运行

alter table your_table modify pk_column generated always as identity;

例如:

SQL> create table a1
  2    (id   number generated by default on null as identity,
  3     ime  varchar2(20));

Table created.

SQL> alter table a1 modify id generated always as identity;

Table altered.

SQL>