which data type is used to store only time part

i have a column in my data base that needs to store date
now i need to store only time like 11:50:16
i tried with the following syntax

insert into table name(column name)values(to_date(sysdate,'hh:mi:ss'))

but it is throwing an error "not a vllid month"

thanks in advance..
 
There is no datatype for only time in Oracle. The datatype DATE always includes both date and time. The sysdate you use is also of datatype DATE and includes it all. You don't need to use to_date on it, since it already is date. If your time value is actually an interval you could use datatype INTERVAL DAY TO SECOND. Another option would be to store as a DATE using the same date all the time and only varying the time part. You could use a check constraint to make sure you always use the same date part.
 
Back
Top