Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: SQL date range question
This query assumes that the NLS_DATE_FORMAT is DD-MON-YYYY.
try:
where mytable.mydatecolumn > to_date('02-MAR-2000','DD-MON-YYYY');
cheers,
John B
Suzanne Edgecombe <suzanne.edgecombe_at_agso.gov.au> wrote in message
news:7H0X4.25$Y16.1090706_at_news.interact.net.au...
> Hi Dave,
>
> your where clause should look something like:
>
> select * from mytable
> where mytable.mydate < '02-MAR-2000';
>
> dates should be in single quotes, but they are able to be used
> "mathmatically" - dont forget the semicolon. You can also use sysdate
> (which gives you system date and time) or trunc(sysdate) (which truncates
> the time from the system date).
>
> cheers
>
> Sue E
>
>
> Dave Knight wrote in message ...
> >I'm a newbie at SQL and I'm attempting to filter some data by excluding
> >records before a certain date. I don't know how to format the line of SQL
> >that will do this.
> >
> >I copied the following "WHERE" section (I know, I cheated) out of the SQL
> >statement that was generated when I built a Crystal Report :
> >
> >WHERE
> > ENTORDER."ESTABLISHED" > {d 2000-05-03'}
> >
> >SQLPlus does NOT like the formatting on this. I get the error message:
> >ORA-01840: input value not long enough for date format
> >
> >How should this be formatted? I think the version of Oracle I'm using is
> >7.2.3.
> >
> >Thanks,
> >Dave Knight
> >
> >
>
>
Received on Thu May 25 2000 - 00:00:00 CDT
![]() |
![]() |