Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Time Fields
A copy of this was sent to Johan den Boer <jj.den.boer_at_hccnet.nl>
(if that email address didn't require changing)
On Sat, 12 Jun 1999 07:00:26 +0200, you wrote:
>Hi,
>
>I have a table with a column timestamp. I created it as a DATE field but
>I want to
>store the time in that field. Does oracle have a special field type like
>TIME ?.
>How do you get the time from the column. I know you can do it
>with to_char( column_name, 'HH24MISS' ) but I don't want to do that
>every time I do a select or fetch on that table.
>
sorry -- thats the way it works. the DATE type contains the day, year, month, hour, minute, and seconds. If you just want to store the time -- you can use a varchar2 field.
For fetching, or for inserting, you can change the default date mask. For example:
alter session set nls_date_format = 'dd-mon-yyyy hh24:mi:ss';
Then, dates will come in and out using that format and you won't need to to_char/to_date them.
>regards Johan den Boer
>
>email : jj.den.boer_at_hccnet.nl
>
See http://www.oracle.com/ideveloper/ for my column 'Digging-in to Oracle8i'... Mirrored (and more current) at http://govt.us.oracle.com/~tkyte/
Current article is "Fine Grained Access Control", added June 8'th
Thomas Kyte tkyte_at_us.oracle.com Oracle Service Industries Reston, VA USA--