ORA-01810
oracle的错误: ORA-01810 format code appears twice Cause: A format code was listed twice in a date specification. Each format code may be specified only once in the function TO_DATE. Action: Remove the duplicate format code from the date specification, then retry the operation.
格式代码出现两次如: sql中的"yyyy-mm-dd hh24:mm:ss"的mm在Oracle只被认为是月的表示,而不是分钟的表示。
Oracle为了区分,特别把分钟用mi来代替。 select to_char(sysdate, 'yyyy-mm-dd hh24:mm:ss') from dual;不会抱错,但显示不是希望的,两个都是月的表示。
正确的:select to_date(to_char(sysdate, 'yyyy-mm-dd hh24:mi:ss'), 'yyyy-mm-dd hh24:mi:ss') now from dual;