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
mamalik
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
joy_division
Messages: 4643
Registered: February 2005
Location: East Coast USA
Senior Member
Hints:

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: Thu Dec 08 22:19:17 CST 2016

Total time taken to generate the page: 0.05392 seconds