Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sysdate minus a timestamp column? 1

Status
Not open for further replies.

Ant0

Technical User
May 3, 2005
17
GB
I can't work out how to return a whole number from

select sysdate-stamp from foo;

where stamp is a timstamp column with a default value of sysdate. All I want ot do is minus the two and capture all rows where the difference is 1.
 
Ant,

"1" what? 1 Year, 1 Month, 1 Day, 1 Hour, 1 Minute, 1 Second, 1/10 Second, 1/100 Second, 1 millisecond? We can offer code as soon as we know what "1" means.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)

Do you use Oracle and live or work in Utah, USA?
Then click here to join Utah Oracle Users Group on Tek-Tips.
 
Ant,

Here are some data:
Code:
SQL> select stamp from foo;

STAMP
----------------------------
18-MAY-05 09.31.13.542000 AM
13-DEC-03 12.56.44.000000 AM

Here are whole-number differences between the current date/time and the dates:
Code:
col a heading "Days|Diff" format 999
select trunc(sysdate-cast(stamp as date)) a from foo;

Days
Diff
----
0
522
Let us know if this resolves your need.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)

Do you use Oracle and live or work in Utah, USA?
Then click here to join Utah Oracle Users Group on Tek-Tips.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top