Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Using date format in Oracle??

Re: Using date format in Oracle??

From: Chrysalis <cellis_at_iol.ie>
Date: 1997/06/19
Message-ID: <33A97F84.5BC@iol.ie>#1/1

Ron Reidy wrote:
>
> greg teets wrote:
>
> > I am confused about the date format in Oracle. Can a record use a
> > date column directly or do you have to use the TO_Date function?
> >
> > If it can be added directly, what is the format? All my date fields
> > error out because of bad format.
> >
> > Thanks
>
> Greg,
>
> What is the format of your date variable? The default is 'DD-MON-YY'.
> If your format is of some other type (e.g. 'MM/DD/YY', etc.), you will
> need to use the TO_DATE function to express the conversion pattern
> (e.g. TO_DATE(:var,'MM/DD/YY')). This is documented in the SQL*Plus
> User's Guide.
>
> Hope this helps.
>
> rr

The answer above may be a little misleading.

The important question is whether the data *type* is defined as date. If so, it is not stored in DD-MON-YY format, although that is the default mask for output to a character field.

The to_date(<col>[,<mask>]) is only needed if <col> is *not* of the date datatype. In this case the function will convert your character field into a date datatype (which may then be converted to a different character format by to_char() if needed)

Conversely, if you need to format a column of date datatype to anything other than the default format, you need to use the to_char() function with the appropriate mask. The result is a field of character datatype.

Chrysalis. Received on Thu Jun 19 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US