【发布时间】:2020-05-29 03:50:35
【问题描述】:
我希望数据库中的所有日期都采用以下 yyyy-mm-dd 日期格式。例如,“2020 年 5 月 28 日”。但这似乎不像我想的那样工作,当我将日期插入包含生日列的用户表中时。
这是我的生日列约束:
birthday DATE NOT NULL CHECK (REGEXP_LIKE(birthday , '\d{4}\-(0?[1-9]|1[012])\-(0?[1-9]|[12][0-9]|3[01])*')),
当我尝试插入时出现以下错误:“2020-05-28”或任何其他日期:
02290. 00000 - "check constraint (%s.%s) violated"
*Cause: The values being inserted do not satisfy the named check
*Action: do not insert values that violate the constraint.
【问题讨论】:
标签: sql oracle date oracle-sqldeveloper