如何在Oracle中处理闰秒

今天晚上将有一个闰秒添加到时钟,在一天的最后一个小时的最后一分钟将有61秒.
2015-06-30 23:59:60

但是,Oracle只能在一分钟内支持最多60秒:

TO_DATE( '2015-06-30 23:59:60','YYYY-MM-DD HH24:MI:SS' )

错误与:

ORA-01852: seconds must be between 0 and 59

SELECT TO_DATE( '2015-06-30 23:59:59','YYYY-MM-DD HH24:MI:SS' ) + INTERVAL '1' SECOND AS Incr_Second_Before,TO_DATE( '2015-07-01 00:00:00','YYYY-MM-DD HH24:MI:SS' ) - INTERVAL '1' SECOND AS Decr_Second_After
FROM   DUAL

给出输出

|     INCR_SECOND_BEFORE |      DECR_SECOND_AFTER |
|------------------------|------------------------|
| July,01 2015 00:00:00 | June,30 2015 23:59:59 |

有没有办法在Oracle中处理闰秒?

从MOS-

Insert leap seconds into a timestamp column fails with ORA-01852 (Doc
ID 1553906.1)

APPLIES TO:

Oracle Database – Enterprise Edition – Version 8.1.7.4 and later

Oracle Database – Standard Edition – Version 8.1.7.4 and later

Information in this document applies to any platform.

SYMPTOMS:

An attempt to insert leap seconds into a timestamp column,fails with:
ORA-01852: seconds must be between 0 and 59

CAUSE

It is not possible to store >59 sec value in a date or timestamp
datatype

SOLUTION

To workaround this issue,the leap second record can be stored in a
varchar2 datatype instead e.g.

sql> create table test (val number,t varchar2(30));

Table created.

sql> insert into test values(123,'2012-06-30T23:59:60.000000Z');

1 row created.

不是最好的解决方案,而是唯一的解决方案.

相关文章

数据库版本:11.2.0.4 RAC(1)问题现象从EM里面可以看到,在23号早上8:45~8:55时,数据库等待会话暴增...
(一)问题背景最近在对一个大约200万行数据的表查看执行计划时,发现存在异常,理论上应该返回100多万...
(一)删除备份--DELETE命令用于删除RMAN备份记录及相应的物理文件。当使用RMAN执行备份操作时,会在RM...
(1)DRA介绍 数据恢复顾问(Data Recovery Advise)是一个诊断和修复数据库的工具,DRA能够修复数据文...
RMAN(Recovery Manager)是Oracle恢复管理器的简称,是集数据库备份(backup)、修复(restore)和恢复...
(1)备份对象 可以使用RMAN进行的备份对象如下: --整个数据库:备份所有的数据文件和控制文件; --数...