I wish to view my column time as ‘hh24:mi:ss’ but even i insert it as to_date(’13:00:00′,’hh24:mi:ss’). It still displays as date format. I have tried different methods to convert and i don’t wish to alter the session.
Here’s my table created:
CREATE TABLE Test
(
Name VARCHAR2(20),
Description Varchar2(20),
StudyTime Date,
SleepTime Date,
);
Insert:
INSERT INTO Test
VALUES('JUDY','STUDYING AT ABC', (To_Date('01:00:00', 'HH24:MI:SS')),
(TO_DATE('06:35:00', 'HH:MI:SS')));
Display results:
Judy,Studying at abc,11-Nov-2011,11-Nov-2011
Thanks for anyone help!
Your IDE or SQL*Plus settings are displaying the default date format of
DD-Mon-YYYY.Even though you are entering just a time format, oracle will still see it as a full date and time, hence the 11-Nov-2011 date (you need to be aware of this!).
When you then select all columns whichever interface you are using to display the results will show you the character representation of the date columns, if you have not specified what that is it will use the default NLS format settings.
See: http://www.adp-gmbh.ch/ora/admin/nls_levels.html
Either change the NLS date format settings or specify using
TO_CHARwhat format you want the results.Try:
N.B. I used
HH24forstudytimeandHHforsleeptimeas you have done in your example when entering your values.This should disply it in the correct format.