Reputation: 1105
I have a table with a log_date
column (dd mm-yy-hh-m-ss
format)
What I have tried is:
select * from dum where(sysdate-log_date)<=1/48;
But does not worked at all so please suggest what should i use?
Upvotes: 0
Views: 1181
Reputation: 1105
SELECT * FROM dum WHERE log_date BETWEEN (SYSTIMESTAMP - 1800/(24*60*60)) AND SYSTIMESTAMP;
Upvotes: 1
Reputation: 168416
Assuming the LOG_DATE
column is of DATE
data type, you can use:
SELECT *
FROM DUM
WHERE log_date >= SYSDATE - INTERVAL '30' MINUTE;
If your LOG_DATE
column is a VARCHAR2
then just wrap it in TO_DATE()
:
SELECT *
FROM DUM
WHERE TO_DATE( log_date, 'dd mm-yy-hh-mi-ss' ) >= SYSDATE - INTERVAL '30' MINUTE;
(and then look at changing your table to use a DATE
data type to store dates rather than using strings.)
Upvotes: 0