Home » SQL & PL/SQL » SQL & PL/SQL » Random Time Between 2 dates
Random Time Between 2 dates [message #361010] Mon, 24 November 2008 12:40 Go to next message
Messages: 266
Registered: November 2008
Location: Pakistan
Senior Member

Dear All.

I need a query to get a random time between 2 dates

Date1 = 05-JAN-2008 4:45:00 AM
Date2 = 05-JAN-2008 5:15:00 AM

I need Random Time between above two dates when query is executed.

Please Help.

[Updated on: Mon, 24 November 2008 12:42]

Report message to a moderator

Re: Random Time Between 2 dates [message #361011 is a reply to message #361010] Mon, 24 November 2008 12:51 Go to previous message
Messages: 4621
Registered: February 2005
Location: East Coast USA
Senior Member

To find the time in days between 2 dates, subtract the lower from the higher. Look at the package DBMS_RANDOM. And use the TO_DATE function properly. If you're still stuck, come back with questions.
Previous Topic: PL/SQL Reflection (merged)
Next Topic: Calculating a row value from the previous row value in a query statement
Goto Forum:

Current Time: Tue Oct 25 16:50:28 CDT 2016

Total time taken to generate the page: 0.11166 seconds