从oracle表中检索最新的时间戳记值 [英] retrieve the latest timestamp value from the oracle table

查看:94
本文介绍了从oracle表中检索最新的时间戳记值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从表中获取最新的时间戳.时间戳值以oracle格式赋值.我尝试了以下操作,但未提供具有最新时间戳记的最新行:

I need the get the latest timestamp from a table. The timestamp values ore in oracle format.I have tried the following but not giving me the latest row that has the most recent timestamp:

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的表的最新时间戳记值.知道我将如何轻松地做到这一点吗?

I need to have the most recent Timestamp value from the table called KPX_PHYSICAL_MEMORY_DV . Any idea how I would do this easily?

推荐答案

请勿将其强制转换为char或将其强制强制转换为YYYYMMDD而不是dd-Mon-yyyy.

Do not cast it to char or do cast it to YYYYMMDD rather than dd-Mon-yyyy as you do.

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%'

这篇关于从oracle表中检索最新的时间戳记值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆