see here for DateTime functions of HANA
you want probably something like
SELECT *, SECONDS_BETWEEN(CURRENT_TIMESTAMP, FILE_MTIME) FROM M_TRACEFILES
(I can't test this right now, but you get the idea)
Here is the whole sql guide of HANA
Pregunta
I have been playing around with SAP's Hana Database. I found an instance of Hana (30 day trial version) deployed on cloudshare.net. I have been firing sql statements on hdbsql ,a command line tool (similar to sql*plus in oracle)
I need help with one specific query written to calculate the age of tracefiles.
Query:
"Select * from M_TRACEFILES"
The query returns trace files and their associated information. I am interested in one column "FILE_MTIME" which is the time and date when the file was created. Its datatype is "timestamp" which in hana has the following format: 'yyyy-mm-dd hh24:mm:ss.fff7' where fff is fractional seconds upto 7 digits example: 2010-01-11 17:38:48.8020025.
To find the age of the tracefile i need: "Current_Local_Timestamp_On_Node - Tracefile_Timestamp".
Following is the way to query current timestamp on a hana node:
SELECT CURRENT_TIMESTAMP "current timestamp" FROM DUMMY;
Output:
current timestamp 2010-01-11 17:38:48.802
How do i do this in one query so that i can get all the tracefile related info and its age in query result.
In Hana are there any timestamp operations like oracle's date operation where you can say "sysdate - somedate".
Thanks
Solución
see here for DateTime functions of HANA
you want probably something like
SELECT *, SECONDS_BETWEEN(CURRENT_TIMESTAMP, FILE_MTIME) FROM M_TRACEFILES
(I can't test this right now, but you get the idea)
Here is the whole sql guide of HANA