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: 4727
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: Sun Apr 30 04:40:44 CDT 2017

Total time taken to generate the page: 0.12693 seconds