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

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL help

Re: SQL help

From: Miguel Camba <mcambab_at_100mbps.es>
Date: Sat, 18 Aug 2001 23:17:47 +0200
Message-ID: <3B7EDB7B.4C079842@100mbps.es>


SQL> select to_date('5/8/2001') from dual;

TO_DATE(



05/08/01

SQL> select to_date('05/08/2001') from dual;

TO_DATE(



05/08/01

SQL> select to_date('5/8/01') from dual;

TO_DATE(



05/08/01

If date separator is /, the input format is not important.

Axl wrote:

> I'm not sure if this is the right place for this question but here goes. I
> am writing a java servlet that creates a SQL statement based on some text
> entered from a web page and executes it against a few Oracle tables. My
> problem is the syntax to query against a date column. The date is stored in
> Oracle one way, but my users will enter the date themselves in a different
> format. For example, they could enter 5/4/2001 as the date to query
> against. I thought I could use to_char(CreatedDate, 'fmMM/DD/YYYY'), but
> that doesn't work. If they enter 05/04/2001 it will work, but I can't count
> on them to enter it correctly with 2 digit months and days. I could write
> some javascript code on the front end to correct the date, but I know there
> must be an easier way to do this. Any ideas?
>
> Thanks,
> Axl
Received on Sat Aug 18 2001 - 16:17:47 CDT

Original text of this message

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