Home » SQL & PL/SQL » SQL & PL/SQL » Query regarding time difference and time difference problem (merged multiple threads)
Query regarding time difference and time difference problem (merged multiple threads) [message #392057] Mon, 16 March 2009 04:14 Go to next message
abhradwip
Messages: 19
Registered: March 2009
Location: INDIA
Junior Member
I have a date column that stores the data in (03-16-2009 02:41:25)
this format. Now I have to fetch the data from the table where the time difference between current time & stored time is greater than 20 minutes.

Can anybody tell me..how can i do it
Re: Query regarding time difference (merged) [message #392067 is a reply to message #392057] Mon, 16 March 2009 04:35 Go to previous messageGo to next message
Michel Cadot
Messages: 64122
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
I have a date column that stores the data in (03-16-2009 02:41:25) this format.

If it is a real DATE datatype column, there is no format.
What is the type of your column?

Have a look at TO_DATE function, Interval Literals, Datetime/Interval Arithmetic

Regards
Michel

[Updated on: Mon, 16 March 2009 04:37]

Report message to a moderator

time difference problem [message #392085 is a reply to message #392057] Mon, 16 March 2009 05:40 Go to previous messageGo to next message
abhradwip
Messages: 19
Registered: March 2009
Location: INDIA
Junior Member
I have a table called admin_session .

user_id session_id last_login_dtm

10 HDGHGDHG 2009-03-16 12:46:22


Now I want to delete those records where the difference between sysdate and last_login_dtm is above 20 mins


how can i do it???
Re: time difference problem [message #392096 is a reply to message #392085] Mon, 16 March 2009 06:01 Go to previous messageGo to next message
Michel Cadot
Messages: 64122
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Why are your reposting the same question? the answer is the same.
But you should answer the question we post:
Quote:
What is the type of your column?

And read the links we recommnend you:
Quote:
Have a look at TO_DATE function, Interval Literals, Datetime/Interval Arithmetic

Regards
Michel
Re: Diffrence between the login_time and sys_time. [message #392130 is a reply to message #392057] Mon, 16 March 2009 09:44 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
If the datatype of LAST_LOGIN_DTM is DATE then you can just look at the value of
sysdate - last_login_dtm


This value is in days, so you'll need to convert it to minutes fro your comparison.
Re: Diffrence between the login_time and sys_time. [message #392131 is a reply to message #392057] Mon, 16 March 2009 09:44 Go to previous messageGo to next message
BlackSwan
Messages: 25042
Registered: January 2009
Location: SoCal
Senior Member
You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
Re: Diffrence between the login_time and sys_time. [message #392136 is a reply to message #392057] Mon, 16 March 2009 10:01 Go to previous messageGo to next message
Michel Cadot
Messages: 64122
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Same answer as your friend a couple of hours ago.
See his topic (now merged).

Regards
Michel

[Updated on: Mon, 16 March 2009 10:02]

Report message to a moderator

Re: Diffrence between the login_time and sys_time. [message #392161 is a reply to message #392136] Mon, 16 March 2009 12:43 Go to previous messageGo to next message
joy_division
Messages: 4641
Registered: February 2005
Location: East Coast USA
Senior Member
Ooops, I deleted the dupe, not realizing it was from someone else. He/she will probably now wonder where their message went. Sorry.
Re: Diffrence between the login_time and sys_time. [message #392227 is a reply to message #392161] Tue, 17 March 2009 01:54 Go to previous message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Even though the IP-addresses differed, the data-example was 100% the same, so the two must have known of each other. Not to worry about the deletion, in my opinion.
Previous Topic: how to use between
Next Topic: ORA-01704: string literal too long in lob columns
Goto Forum:
  


Current Time: Wed Dec 07 05:02:48 CST 2016

Total time taken to generate the page: 0.18383 seconds