简体   繁体   中英

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 ?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM