Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I create a "time" field???

Status
Not open for further replies.

lminmei

Programmer
Feb 1, 2000
111
US
This is a beginner question....
I am creating a table with a field called time and i just want that field to store hh:mm AM/PM ...
How do i do this in the CREATE TABLE statement???

Please help,
Thanks
 
Oracle doesn't support just a time field. It has a DATE field that contains both time and date. You declare it like this
Code:
create table xxx (
.
.
.
   archive_date_time  DATE
.
.
.
)
If you just want to see the time component, when you query use the TO_CHAR function and only specify the time... like this:
Code:
SELECT TO_CHAR (archive_date_time, 'HH:MI:SS AM') archive_time
FROM xxx
WHERE
.
.
.

Another option is to use a CHAR or VARCHAR2 field of the proper length and just store times.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top