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: help!how to select date field?

Re: help!how to select date field?

From: <oratune_at_aol.com>
Date: Tue, 05 Sep 2000 21:57:32 GMT
Message-ID: <8p3q83$hst$1@nnrp1.deja.com>

In article <8ovksl$3q1$1_at_news.cz.js.cn>,   "mike" <skyxx_at_263.net> wrote:
> hi:
> i am a beginer of oracle.i want to select a date field,some one tell
 me
> use like below:
> select * from tablename where datefield =
> TO_DATE('2000/9/4','YYYY_MM_DD'),can u tell me some more simple
 mothed,like
> ms sql's :
> select * from tablename where datefield ='2000/9/4'
> or like Access:
> select * from tablename where datefield =#2000/9/4#
>
> thank u.
> mike 2000/9/4
>
>

You could set a session parameter named NLS_DATE_FORMAT for your session:

alter session set NLS_DATE_FORMAT = 'YYYY/MM/DD';

After that you could specify dates in a YYYY/MM/DD format without using the TO_DATE function:

    select * from tablename where datefield = '2000/09/04';

It is always best, however, to use the TO_DATE function, especially in SQL*Plus scripts, since you won't know how the date format is specified on different systems. This ensures that scripts are portable between installations/implementations/versions of ORACLE.

--
David Fitzjarrell
Oracle Certified DBA


Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Tue Sep 05 2000 - 16:57:32 CDT

Original text of this message

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