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: DATE in SQL

Re: DATE in SQL

From: Enkidu Utnapishtim <utnapishtim43NOSPAM_at_hotmail.com>
Date: Mon, 22 Jul 2002 20:19:19 GMT
Message-ID: <3D3C68C6.4060507@hotmail.com>


I second Paul's observation about always using an explicit to_date ... but maybe for a different reason. Someone here chose Benthic Golden as our GUI replacement for SQLPlus (another story). Well, Golden ignores what you set as the database default date format. According to their help file, this is because not explicitly specifying it promotes "lazy" programming ... so they're going to convert the world ... one developer at a time. :) [BTW, I snuck Toad on my PC while they weren't looking.]

Roger Crowley - DBA - LearningFramework

Paul Brewer wrote:

> "Richard Foote" <richard.foote_at_bigpond.com> wrote in message
> news:YkT_8.41305$Hj3.123974_at_newsfeeds.bigpond.com...
> 

>>Hi Kondor
>>
>>select ARTID from ARTICLES a, PAGES p
>>where a.PGID=p.PGID and
>>a.PGVERSION=p.PGVERSION and
>>p.PGDATEPUB > '19/07/2002'
>>
>>assuming dd/mm/yyyy is your default date format.
>>
>>p.PGDATEPUB > to_date('19/07/2002', 'DD/MM/YYYY')
>>
>>will always work as well.
>>
>>Regards
>>
>>Richard
>>
>>"kondor" <kondor_at_wanadoo.fr> wrote in message
>>news:3D3C0099.4070100_at_wanadoo.fr...
>>
>>>Hi,
>>>I want to execute a request that return me the rows where date is more
>>>recent than 2002-07-19 (19/07/2002 in french format) I try :
>>>
>>>select ARTID from ARTICLES a, PAGES p
>>>where a.PGID=p.PGID and
>>>a.PGVERSION=p.PGVERSION and
>>>p.PGDATEPUB > to_date('19 07 2002','DD MM YY')
>>>
>>>or :
>>>
>>>select ARTID from ARTICLES a, PAGES p
>>>where a.PGID=p.PGID and
>>>a.PGVERSION=p.PGVERSION and
>>>p.PGDATEPUB > date '19/07/2002'
>>>
>>>but It returns me an error.
>>>
>>>Can you help me ...
>>>THANKS .
>>>
>>
> Richard,
> 
> You are of course absolutely correct, but in common with other posters I
> would always recommend developers to use to_date explicitly rather than rely
> on any default.
> 
> kondor wrote:
> 

>>to_date('19 07 2002','DD MM YY')
> 
> Try YYYY.
> 
> Regards,
> Paul
> 
> 
> 
Received on Mon Jul 22 2002 - 15:19:19 CDT

Original text of this message

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