---
title: OceanBase 数据库 MySQL 模式暂不支持的 DDL 命令总结-OceanBase数据库使用指南
description: 了解OceanBase数据库在实际应用中关于OceanBase 数据库 MySQL 模式暂不支持的 DDL 命令总结相关的常见问题和使用技巧，帮助您快速解决OceanBase 数据库 MySQL 模式暂不支持的 DDL 命令总结的难题。
image: https://mdn.alipayobjects.com/huamei_22khvb/afts/img/A*OSPzQ6GUQF4AAAAAQHAAAAgAeiGDAQ/original
---
切换语言

- 中文站 - 简体中文
- International - English
- 日本站 - 日本語

划线反馈

# OceanBase 数据库 MySQL 模式暂不支持的 DDL 命令总结

更新时间：2026-05-21 09:16

适用版本： V1.4.x、V2.1.x、V2.2.x、V3.1.x、V3.2.x 内容类型：Troubleshoot  

本文主要介绍 MySQL 模式中暂不支持的 DDL 语法。

样例表：

```shell
MySQL [test]> CREATE TABLE `t1` (`id` varchar(64) DEFAULT NULL);
Query OK, 0 rows affected (0.064 sec)

```

- 暂不支持缩短字段的长度。

  ```shell
  MySQL [test]> alter table t1 modify column `id` varchar(32);
  ERROR 1235 (0A000): Truncate the data of column schema not supported

  ```
 - 暂不支持添加非空约束。

  ```shell
  MySQL [test]> alter table t1 modify column `id` varchar(64) not null;
  ERROR 1138 (22004): Invalid use of NULL value

  ```
 - 暂不支持增加、删除、修改主键。

  ```shell
  MySQL [test]> alter table t1 add PRIMARY KEY (`id`);
  ERROR 1235 (0A000): Not supported feature or function

  ```

  ```shell
  MySQL [test]> alter table t1 drop primary key;
  ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'primary key' at line 1

  ```

  ```shell
  MySQL [test]> alter table t1 add primary key (`time`);
  ERROR 1235 (0A000): Not supported feature or function

  ```
 - 暂不支持不兼容列类型的修改。

  ```shell
  MySQL [test]> CREATE TABLE `t2` (`id` int(32) DEFAULT NULL);
  Query OK, 0 rows affected (0.042 sec)

  ```

  ```shell
  MySQL [test]> alter table t2  modify column id varchar(32);
  ERROR 1235 (0A000): Alter non string type not supported

  ```
 - 暂不支持后面再调整字段顺序，仅新建字段时支持调整顺序。

  ```shell
  MySQL [test]> alter table t1 add column `time` date default null;
  Query OK, 0 rows affected (0.021 sec)

  ```

  ```shell
  MySQL [test]> alter table t1 add column `test_after` varchar(20) after `id`;
  Query OK, 0 rows affected (0.022 sec)

  ```

  ```shell
  MySQL [test]> alter table t1 modify `test_after` varchar(20) after `time`;
  ERROR 1235 (0A000): Not supported feature or function

  ```

## 适用版本

OceanBase 数据库 V4.0 以前的所有版本。

Previous

[OceanBase 数据库 MySQL 租户对象大小写默认值](https://www.oceanbase.com/knowledge-base/oceanbase-database-20000000017)

Next

[如何为 DDL 执行添加并发参数来提升性能](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000000444009) ![有帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*y6ocSqN8cqsAAAAAAAAAAAAAARQnAQ)![无帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*BG9IQJyLHF8AAAAAAAAAAAAAARQnAQ)![反馈](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*eTWdQKCRKHwAAAAAAAAAAAAAARQnAQ)[AI](https://www.oceanbase.com/obi) 咨询热线
