我是SQL开发人员的新手,但每次我收到查询时都会将时间戳更改为可读日期格式,但我希望我的结果是时间戳,因为它们在数据库中。
答案 0 :(得分:1)
请转到:工具/首选项/数据库/ NLS,并将日期格式和时间戳格式设置为您想要的格式。
Oracle存储日期和时间戳类型,但根据NLS设置显示它。您可以致电alter session set NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH:MI:SS.FF';
或在客户端工具中设置这些NLS设置。
答案 1 :(得分:0)
我终于找到了要做的事, 我刚刚从
更改了我的SQL查询SELECT ALARMID,ALARMNAME,ALERTKEY,SITENAME,FIRSTOCCURRENCE,LASTOCCURRENCE,CLEARTIME,NODE,MANAGER
FROM ACROSSFM1.REPORTER_STATUS
WHERE ALARMID IN ('301','21801','22202','29240','14001','29201','199087342',
'199087337','198099803','199083022','199066019','199083023',
'198094419','198094422','S1 Link is Broken',
'CELL LOGICAL CHANNEL AVAILABILITY SUPERVISION','UtranCell_NbapMessageFailure',
'UtranCell_ServiceUnavailable','UtranCell_RBSLocalCellNotAdded',
'Heartbeat Failure','ResourceConfigurationFailure','ServiceUnavailable',
'Resource Activation Timeout','ResourceAllocationFailure','S1apLinkDown')
AND Type = 2
AND LASTOCCURRENCE > (SYSDATE-(1/24));
到
SELECT ALARMID,ALERTKEY,ALARMNAME,SITENAME,CEIL(((FIRSTOCCURRENCE)- (TO_DATE('1970-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS'))) * 86400),CEIL(((LASTOCCURRENCE)- (TO_DATE('1970-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS'))) * 86400),CEIL(((CLEARTIME)- (TO_DATE('1970-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS'))) * 86400),NODE,MANAGER
FROM ACROSSFM1.REPORTER_STATUS
WHERE ALARMID IN ('301','21801','22202','29240','14001','29201','199087342','199087337','198099803','199083022','199066019','199083023','198094419','198094422','S1 Link is Broken','CELL LOGICAL CHANNEL AVAILABILITY SUPERVISION','UtranCell_NbapMessageFailure','UtranCell_ServiceUnavailable','UtranCell_RBSLocalCellNotAdded','Heartbeat Failure','ResourceConfigurationFailure','ServiceUnavailable','Resource Activation Timeout','ResourceAllocationFailure','S1apLinkDown','21807','21825')
AND Type = 2
AND LASTOCCURRENCE > (SYSDATE-(1/24));
我会说
CEIL(((FIRSTOCCURRENCE)- (TO_DATE('1970-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS'))) * 86400)
完成了这项工作。