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

Home -> Community -> Usenet -> c.d.o.server -> Re: Default NLS_DATE_FORMAT opinions please

Re: Default NLS_DATE_FORMAT opinions please

From: Nick Pope <nick.pope_at_retaininternational.com>
Date: Fri, 16 Feb 2001 11:01:49 -0000
Message-ID: <t8q2e92k49s144@xo.supernews.co.uk>

I would suggest that in all code you explicitly tell Oracle what format you are using in SQL queries. This ensures that if you change the setting your code will still work!

E.g.

rather than

select *
from sales
where sales_date > '01-Jan-2001'

you would write

select *
from sales
where sales_date > to_date('01012001','ddmmyyyy')

i.e. I have explicitly told Oracle what format my data parameter is in.

Why do this?
- if you change the data format for the database - if you create copies of the database and forget to set all parameters to the same format you may hit this problem - if you create copies of the database for other countries, they may insist on using a different format and then your code will not work!

Uchakra <uchakra_at_aol.com> wrote in message news:20010215233456.04907.00000247_at_ng-cd1.aol.com...
> In general 'DD-MM-YYYY' should be OK.
> Some applications may require
> precise time to distinguis one row (date field) from
> another and for that purpose, some people
> use a format like
> 'DD-MM-YYYY HH24:MI:SS'
>
> Think about your rquirement to see if
> you need that.
>
> In most case 'DD-MM-YYYY' would be OK.
>
> Regards
> Willy
Received on Fri Feb 16 2001 - 05:01:49 CST

Original text of this message

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