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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deducting a selected time stamp from sysdate

Status
Not open for further replies.

Larshg

Programmer
Mar 1, 2001
187
DK
Hi

I'm using Oracle 9.2.0

I want to find out how many minutes a times stamp is older then sysdate.

This is the select that I use to find my timestamp.

select min(to_char(sys_creation_date,'YYYYMMDD HH24MI')) from ac_processing_accounting
where file_status='RD'
and (fpfc_nxt_pgm_name='LONG_DURATION01'
or fpfc_nxt_pgm_name='LONG_DURATION02'
or fpfc_nxt_pgm_name='LONG_DURATION03'
or fpfc_nxt_pgm_name='LONG_DURATION04');


This is how I would normaly find time diffrence

select trunc(((sysdate) - to_date('20041206 1300 ','YYYYMMDD HH24MI'))*1440) from dual;

I can't seem to combine thise 2 in a way that gives me the result I want.

Thanks

/Larshg
 
Larshg,

I believe what you want (if you wish to show both the minimum sys_creation_date and its age in minutes) is:
Code:
col a heading "Earliest|Creation|Date" format a14
col b heading "Age|(in|mins.)" format 999,999.9
select  min(to_char(sys_creation_date,'YYYYMMDD HH24MI')) a
      ,(sysdate-min(start_date))*1440 b
from...

Let us know if this resolves your need.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
@ 15:34 (06Dec04) UTC (aka "GMT" and "Zulu"),
@ 08:34 (06Dec04) Mountain Time
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top