设置Date类型默认值出错

obclient(root@sys)[ECommerceSys]> alter table customers alter column RegistrationDate set default CURRENT_DATE;
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 ‘CURRENT_DATE’ at line 1

1 个赞

语法错误CURRENT_DATE加个括号

1 个赞

@论坛小助手

1 个赞

obclient(root@sys)[(none)]> alter table customers alter column RegistrationDate set default (CURRENT_DATE);
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 ‘(CURRENT_DATE)’ at line 1
也不行

1 个赞

mysql> alter table test1 alter column RegistrationDate set default (CURRENT_DATE);
Query OK, 0 rows affected (0.40 sec)

1 个赞

image
你的ob版本是什么,alter … alter这种语法在最新版本才支持

1 个赞