user2990430
user2990430

Reputation: 23

SQL invalid datatype time

I am trying to create a table in Oracle SQL*Plus and it won't take the datatype time, but has no problem taking the datatype date.

drop table order;
create table orders (
order_id char(4) not null,
order_date date,
order_time time, -- invalid datatype
cash_time char(3),
primary key(order_id)
);

That's weird... why is that? How can I fix it, or are there alternatives to using time?

Upvotes: 1

Views: 10071

Answers (2)

farzad
farzad

Reputation: 409

I quickly looked at the orcle datatype documentation and didn't see a time datatype and i think it's the problem. why you don't use the date datatype as a single field instead of creating two field for date and time.

Upvotes: 0

Rahul Tripathi
Rahul Tripathi

Reputation: 172618

In Oracle there is no datatype as TIME. You can use TIMESTAMP or DATE. So I think you need to change TIME to TIMESTAMP or DATE and things will work for you.

I think you are getting confused with this TIME datatype.

Upvotes: 3

Related Questions