lightdb22.3-新增支持oracle语法(modify column&drop primary key)

Posted 紫无之紫

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了lightdb22.3-新增支持oracle语法(modify column&drop primary key)相关的知识,希望对你有一定的参考价值。

lightdb 22.3 - 新增支持oracle 语法(modify column&drop primary key)

在LightDB 22.3 版本中新增了oracle语法的支持:

  • 对alter table modify column语法的部分支持,下面会列出具体支持哪些, 哪些不支持。
  • 对 alter table drop primary key 的支持,可以不通过约束名直接删除主键

modify column

修改字段属性,目前支持如下用法:

1. 修改字段类型, oracle 没有USING expression, lightdb用于指定cast
MODIFY column_name data_type [ USING expression ]

2. 修改字段默认值
MODIFY column_name DEFAULT expression 

3. 修改字段 是否可为null
MODIFY column_name  NOT NULL | NULL  [ENABLE]

4. 修改字段 IDENTITY
MODIFY column_name GENERATED  ALWAYS | BY DEFAULT  AS IDENTITY [ ( sequence_options ) ]
MODIFY column_name DROP IDENTITY
    MODIFY column_name CONSTRAINT constraint_name  NOT NULL | NULL  [ENABLE]
    
5. 修改字段增加约束
-- unique
MODIFY column_name CONSTRAINT constraint_name UNIQUE [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
-- PRIMARY KEY
MODIFY column_name CONSTRAINT constraint_name PRIMARY KEY [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
-- REFERENCES
MODIFY column_name CONSTRAINT constraint_name REFERENCES reftable [ ( refcolumn ) ] 
    [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ] [ ON DELETE referential_action ] [ ON UPDATE referential_action ] [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
-- CHECK 目前不检验实际字段是否一致
MODIFY column_name CONSTRAINT constraint_name CHECK '(' a_expr ')' [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]

不支持用法

  • modify_col_properties:

    • encrypt/decrypt

    • LOB_storage_clause

    • alter_XMLSchema_clause

    • default on null

  • modify_virtcol_properties

  • modify_col_visibility

  • modify_col_substitutable

drop primary key

语法:

alter table table_name drop priamry key;

以上是关于lightdb22.3-新增支持oracle语法(modify column&drop primary key)的主要内容,如果未能解决你的问题,请参考以下文章

lightdb22.3-oracle系统视图兼容增强

lightdb22.3-oracle 内置包兼容增强

lightdb22.3-oracle 内置包兼容增强

lightdb22.3-oracle系统视图兼容增强

lightdb22.3特性预览-增强对oracle内置函数的兼容

lightdb22.3特性预览-增强对oracle内置函数的兼容