If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Recording the time

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-18-05, 08:46
cwil2 cwil2 is offline
Registered User
 
Join Date: Jan 2005
Posts: 9
Exclamation Recording the time

Can anyone tell me if there is a data type used in oracle for recording the time of an event. The SQL books I have read mention the TIME data type but this is not recognised in oracle.
I have tried the timestamp but I require the time and date in separate columns?
Reply With Quote
  #2 (permalink)  
Old 01-18-05, 09:01
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,605
At least in my opinion, storing the time and date in different columns is an extraordinarily bad idea. They are both parts of the same thing (a temporal data type), and storing them as two columns makes as much sense as storing money as dollars in one int and the cents in another int... It certainly can be done, but it is a fundamentally bad idea.

If you insist on doing things the hard way, Oracle will gladly let you. Create two separate timestamp columns. Store the date in one of the columns, and the time in the other. Or store both of them in one column, and use the time manipulation functions to extract just the time or date when you only need one of them.

-PatP
Reply With Quote
  #3 (permalink)  
Old 01-18-05, 09:11
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
what is the time of an event?

do you mean "this event lasts for two hours and fifteen minutes"?

or do you mean "this event occurs at 3:30 pm every day"?

if the former, use an INTERVAL

if the latter, use DATE (which stores date and time) and ignore the date portion
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On