0

我需要从表中获取最新的时间戳。时间戳值是 oracle 格式的。我尝试了以下方法,但没有给我具有最新时间戳的最新行:

SELECT max(to_char(CAST((FROM_TZ(CAST(GET_UTC_TIMESTAMP(T."Timestamp", TMZDIFF) AS TIMESTAMP),'+00:00') AT TIME ZONE 'US/Eastern') AS DATE),'dd-Mon-yyyy hh24:mi')) as DATETIME FROM DW.KPX_PHYSICAL_MEMORY_DV T where T."Node" like 'server%'

我需要从名为 KPX_PHYSICAL_MEMORY_DV 的表中获取最新的时间戳值。知道如何轻松做到这一点吗?

4

1 回答 1

3

不要将其转换为 char 或将其转换为YYYYMMDD而不是dd-Mon-yyyy像您一样。

SELECT max(CAST((FROM_TZ(CAST(GET_UTC_TIMESTAMP(T."Timestamp", TMZDIFF) AS TIMESTAMP),'+00:00') AT TIME ZONE 'US/Eastern') AS DATE) as DATETIME 
FROM DW.KPX_PHYSICAL_MEMORY_DV T 
where T."Node" like 'server%'
于 2013-06-04T19:02:27.517 回答