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: Simple Query Question

Re: Simple Query Question

From: G Quesnel <dbaguy_ott_at_yahoo.com>
Date: Mon, 23 Jul 2007 13:02:36 -0700
Message-ID: <1185220956.187292.271880@g4g2000hsf.googlegroups.com>


On Jul 23, 3:29 pm, Smitty <marksmith..._at_hotmail.com> wrote:
> On Jul 23, 3:23 pm, Michael O'Shea <michael.os..._at_tessella.com> wrote:
>
> > On Jul 23, 8:09 pm, Smitty <marksmith..._at_hotmail.com> wrote:
>
> > > Hello everyone. I have a table with a DATE column, which defaults to
> > > the sysdate during inserts etc.. It's format is 4/26/2007 3:26:22
> > > PM. How can I select all records from this table, where this DATE is
> > > between two 'prompted' dates? I am a newbie, so I apologize for the
> > > simple question. Thanks a lot.
>
> > Hi, if you're up to using sqlplus, try something like the following.
>
> > select something
> > from somewhere
> > where yourDateColumn between to_date('&d1','dd-mon-yyyy') and
> > to_date('&d2','dd-mon-yyyy')
>
> > Change the date mask to whatever you require.
> > Regards
> > Mike
>
> Thanks for the reply. When I try this, I get the same error as I was
> getting with mine:
> ORA-01843: Not a valid month- Hide quoted text -
>
> - Show quoted text -

Mike added a correction which you would need... the date value must be in single quote.
It looks like your problem is matching the date mask to the value you input.
The value is stored internally as a date not a string, so the way Oracle shows the value is almost irrelevant. Can you show a values to you have put in? Is it something like 07-23-2007 Received on Mon Jul 23 2007 - 15:02:36 CDT

Original text of this message

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