设置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

2 个赞

语法错误CURRENT_DATE加个括号

3 个赞

@论坛小助手

3 个赞

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
也不行

2 个赞

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

2 个赞

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

2 个赞

涨知识了

1 个赞

我测试的也没有报错啊

1 个赞