user6522753
user6522753

Reputation:

Looking To Create A Table With A Time Field

I am creating some tables from MS Access to Oracle and am having problems with the time field.

The table below entertainers is expecting timestamp to be in the format of YYYY-MM-DD-HH-MM-SS etc.

I am looking to declare it as Time only field to hold values such as 22:00:00.

Is this possible?

CREATE TABLE Engagements (
EngagementNumber number NOT NULL ,
StartDate date NULL ,
EndDate date NULL ,
StartTime timestamp NULL ,
StopTime timestamp NULL ,
ContractPrice decimal(15,2) NULL ,
CustomerID int NULL ,
AgentID int NULL ,
EntertainerID int NULL 
);

Upvotes: 0

Views: 61

Answers (1)

David Aldridge
David Aldridge

Reputation: 52356

It would be more conventional to combine the date and time components into single columns of start_datetime and end_datetime. Separating them offers no advantages, and there is no TIME data type.

EDIT: Just in response to comments, I of course agree that a TIME data type would have its uses, but in this answer I'm speaking only in the context of whether a DATETIME should be split into separate DATE and TIME elements (which it should not).

Upvotes: 2

Related Questions