Home » SQL & PL/SQL » SQL & PL/SQL » Loading time dimension table (oracle 10g)
Loading time dimension table [message #305729] Tue, 11 March 2008 14:20 Go to next message
kanjiri123
Messages: 3
Registered: March 2008
Junior Member
I need to populate a table dim_time(timeseq number, timenow date)
such as i can get each and evry second of the day like
00:00:00
00:00:01
00:00:02
.
.
00:59:59
01:00:00
01:00:01
.
.
23:59:59
can someone help me with this.
Thanks in advance.
Re: Loading time dimension table [message #305731 is a reply to message #305729] Tue, 11 March 2008 14:28 Go to previous messageGo to next message
ThomasG
Messages: 3212
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
A simple row generator and a little maths :

SELECT Trunc(SYSDATE) + ( 1 / (24 * 60 * 60) ) * ( rownum - 1 )
  FROM  ( SELECT 1 just_a_column
         FROM   dual
         CONNECT BY LEVEL <= (24 * 60 * 60)
        )


Re: Loading time dimension table [message #305732 is a reply to message #305729] Tue, 11 March 2008 14:31 Go to previous message
Michel Cadot
Messages: 68733
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
And it is NO MORE an expert question since years.
Why are you posting this question in Expert forum?

It is clearly stated in the forum description: "Newbies should not post to this forum!"
Expert notion is defined in the sticky: Not an EXPERT? Post in the NEWBIES forum, NOT here
Rules are described in: OraFAQ Forum Guide
Follow them.

Regards
Michel
Previous Topic: PL/SQL Variable Declarations
Next Topic: SQL Help
Goto Forum:
  


Current Time: Sat Feb 08 19:32:33 CST 2025