# ORA-01858: a non-numeric character was found where a numeric was expected

**URL:** <https://www.ruby-forum.com/t/ora-01858-a-non-numeric-character-was-found-where-a-numeric-was-expected/115654>\
**Category:** Rails\
**Created:** [September 27, 2007, 8:08am UTC](https://www.ruby-forum.com/t/ora-01858-a-non-numeric-character-was-found-where-a-numeric-was-expected/115654 "2007-09-27T08:08:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bala](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/94ad74/32.png) [@Bala](https://www.ruby-forum.com/u/Bala)\
**Post date:** [September 27, 2007, 8:08am UTC](https://www.ruby-forum.com/t/ora-01858-a-non-numeric-character-was-found-where-a-numeric-was-expected/115654/1 "2007-09-27T08:08:25Z")

</div>

Hi Experts,

When i execute this statement i got an error called ORA-01858

mobile\_number = ‘1234567890’  
email = “removed\_email\_address@domain.invalid”  
secret\_question = “whats your name”  
secret\_answer = “crystal”  
date\_of\_birth = “20-SEP-90”

User.find(:first, :conditions =\> “mobile\_number=’#{mobile\_number}’ and  
email=’#{email}’ and date\_of\_birth=’#{date\_of\_birth}’ and  
secret\_question=’#{secret\_question}’ and  
secret\_answer=’#{secret\_answer}’”)

ORA-01858: a non-numeric character was found where a numeric was  
expected

but when i execute as query in BE its working well, anyhow, i’ve tried  
using to\_date(’#{date\_of\_birth}’, ‘dd-mon-yy’) the query executes well  
with none record return, but i’ve the value of “20-SEP-90” on my db

anyway, i’ve a model Users with date\_of\_birth column with the type  
of :date

any suggestions?

is there any difference between rails date and oracle date?

thanks in advance Experts

waiting for the reply,

regards,

Bala

---

<div class="post-metadata">

**Author:** ![Bala](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/94ad74/32.png) [@Bala](https://www.ruby-forum.com/u/Bala)\
**Post date:** [September 27, 2007, 9:39am UTC](https://www.ruby-forum.com/t/ora-01858-a-non-numeric-character-was-found-where-a-numeric-was-expected/115654/2 "2007-09-27T09:39:02Z")

</div>

Hi, Bala

You have to use Class Date to wrap the your date\_of\_birth string, Try  
following:

date\_of\_birth=Date.new(1990,9,20)

And execute your query statement again to see if it can get correct  
result.

Regards,  
Liming

---

<div class="post-metadata">

**Author:** ![Bala](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/94ad74/32.png) [@Bala](https://www.ruby-forum.com/u/Bala)\
**Post date:** [September 27, 2007, 9:50am UTC](https://www.ruby-forum.com/t/ora-01858-a-non-numeric-character-was-found-where-a-numeric-was-expected/115654/3 "2007-09-27T09:50:10Z")

</div>

Hi Liming,

Thanks for the reply.

I’ve tried like you suggest, i dont get ORA error, but the record  
fetch none.  
still its says empty

Regards,

Bala

---

<div class="post-metadata">

**Author:** ![Bala](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/94ad74/32.png) [@Bala](https://www.ruby-forum.com/u/Bala)\
**Post date:** [September 27, 2007, 9:50am UTC](https://www.ruby-forum.com/t/ora-01858-a-non-numeric-character-was-found-where-a-numeric-was-expected/115654/4 "2007-09-27T09:50:45Z")

</div>

Hi Liming,

Thanks for the reply.

I’ve tried like you suggest, i dont get ORA error, but the record  
fetch none.  
still its says empty

Regards,

Bala

---

<div class="post-metadata">

**Author:** ![Bala](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/94ad74/32.png) [@Bala](https://www.ruby-forum.com/u/Bala)\
**Post date:** [September 27, 2007, 9:54am UTC](https://www.ruby-forum.com/t/ora-01858-a-non-numeric-character-was-found-where-a-numeric-was-expected/115654/5 "2007-09-27T09:54:19Z")

</div>

Oh My Bad, so Sorry Liming,

got it, i’ve typed wrong date.

it works perfectly.

Thanks a lot.

regards,

Bala

---

<div class="post-metadata">

**Author:** ![Bala](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/94ad74/32.png) [@Bala](https://www.ruby-forum.com/u/Bala)\
**Post date:** [September 27, 2007, 10:14am UTC](https://www.ruby-forum.com/t/ora-01858-a-non-numeric-character-was-found-where-a-numeric-was-expected/115654/6 "2007-09-27T10:14:25Z")

</div>

A little bit strange, how about only using date\_of\_birth condition  
like following?

User.find(:first, :conditions =\> "date\_of\_birth=’#{date\_of\_birth}’ ")

I just guess that maybe some other field doesn’t match.
