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: Oracle Select Problem

Re: Oracle Select Problem

From: Sybrand Bakker <gooiditweg_at_sybrandb.demon.nl>
Date: Thu, 24 Oct 2002 06:44:23 +0200
Message-ID: <2jueru00qd51lvvf0m4pq6q7ijv0dqeet3@4ax.com>


On 23 Oct 2002 18:03:52 -0700, tarbuza_at_yahoo.com (Tarbuza Smith) wrote:

>I have a web interface where user types in name and date of birth. It
>is posted as as post method of form action and Java Servlet parses
>these two values and store as a String. Till upto here, everything is
>fine.
>
>Actually data is stored in a date format in Oracle whereas web
>interface data is in a string format. I am trying to use to_char but I
>am getting error messasge. I am checking whether the user who typed in
>account number and birth date exists in the Oracle database or not.
>
>select ACCOUNT,BirthDate from members WHERE ACCOUNT='"
>+sAccount+"' AND to_char(BirthDate,'mm/dd/yyyy')="
>+sBirthDate);
>
>I am getting the following error message:
>
>Error Code:java.sql.SQLException: ORA-01722: invalid number
>
>Any help would be greatly appreciated. Thanks in advance.

It should be
Birthdate = to_date(sBirthdate,'mm/dd/yyyy') Your code will force Oracle not to use indexes.

Hth

Sybrand Bakker, Senior Oracle DBA

To reply remove -verwijderdit from my e-mail address Received on Wed Oct 23 2002 - 23:44:23 CDT

Original text of this message

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