Home » SQL & PL/SQL » SQL & PL/SQL » using SYSDATE (code interpretation) (Oracle 10g)
using SYSDATE (code interpretation) [message #332723] Wed, 09 July 2008 08:34 Go to next message
ydsouza
Messages: 3
Registered: April 2008
Junior Member
Hi,
I will be very grateful if you could interpret the code below for me:
select sdate from CELLSTATS_60
where sdate >= sysdate-2/24

Looks pretty simple but I just can't interpret it. Thank you so much.
Re: using SYSDATE (code interpretation) [message #332724 is a reply to message #332723] Wed, 09 July 2008 08:37 Go to previous messageGo to next message
Michel Cadot
Messages: 64120
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
1 = 1 day
1/24= 1 hour
1/24/60 = 1 minute
1/24/60/60 = 1 second

Regards
Michel
Re: using SYSDATE (code interpretation) [message #332726 is a reply to message #332723] Wed, 09 July 2008 08:43 Go to previous messageGo to next message
Olivia
Messages: 519
Registered: June 2008
Senior Member
Quote:

where sdate >= sysdate-2/24


less than or equal to 2 hrs from the given date ..
Try to understand like this..


SQL>SELECT to_char((sysdate-2/24),'dd/mm/yyyy hh24:mm:ss') from dual
SQL> /

TO_CHAR((SYSDATE-2/
-------------------
09/07/2008 07:07:02

SQL> select to_char((sysdate),'dd/mm/yyyy hh24:mm:ss') from dual
  2  ;

TO_CHAR((SYSDATE),'
-------------------
09/07/2008 09:07:27

SQL> 


[Updated on: Wed, 09 July 2008 08:47]

Report message to a moderator

Re: using SYSDATE (code interpretation) [message #332727 is a reply to message #332723] Wed, 09 July 2008 08:44 Go to previous message
dwarak.k
Messages: 61
Registered: June 2008
Location: Hyderabad
Member
Chk ths.
The result will explain.
'-2/24' gives you 2 hrs less

select to_char(sysdate-2/24,'DD-MON-YYYY HH24:MI:SS'),
       to_char(sysdate,'DD-MON-YYYY HH24:MI:SS') 
from dual
Previous Topic: Error : ORA-01410: invalid ROWID while executing a package
Next Topic: filter invalid amount records
Goto Forum:
  


Current Time: Tue Dec 06 14:24:47 CST 2016

Total time taken to generate the page: 0.10582 seconds