wood burning stoves 2.0*
The moose likes JDBC and the fly likes ORA-01858: a non-numeric character was found where a numeric was expected Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "ORA-01858: a non-numeric character was found where a numeric was expected" Watch "ORA-01858: a non-numeric character was found where a numeric was expected" New topic
Author

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

leonardo ginting
Ranch Hand

Joined: Jul 25, 2011
Posts: 48
hi Expert

i have an issue about how to call store procedure from database and i got this error when i passing paramater to the store procedure

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

and this is my code

and the error pointed at paramater 3 = cs.setInt(3, new Integer(endSuffix));

and this the code from store procedure


actually i thought that i've setted the parameter as Integer but why could i got this error?
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

Please show us the full error message. What exactly "pointed at paramater 3 = cs.setInt(3, new Integer(endSuffix));"? I believe you've misdiagnosed the problem.

The ORA-01858 error message indicates a problem in date/time conversion. You might want to check the code of your stored procedure for these conversions. Furthermore, the error message should contain the PL/SQL stack trace which could point you to the line in your procedure where the error occurred.



leonardo ginting
Ranch Hand

Joined: Jul 25, 2011
Posts: 48
Hi Martin Thanks for replied

any way here is the Exception

Caused by: java.sql.SQLException: ORA-01858: a non-numeric character was found where a numeric was expected
ORA-06512: at "MYDB.MYPROCEDURE", line 24
ORA-06512: at line 1

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:215)
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:954)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1169)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3390)
at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4223)
...


so are this exception comes up because error when inserting Date?
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

It must be something else. If you were not passing in an int/Integer, the setInt() call in Java would fail.

Could you take the full source code of the procedure right from the database (using eg. the SQL Developer) and post it here?

Also, make sure there aren't multiple copies of the procedure, such as overloaded ones, and that you're not by mistake calling a procedure from another schema than you intend to.
leonardo ginting
Ranch Hand

Joined: Jul 25, 2011
Posts: 48
hi Martin,,

thanks for helping me by the way, and you're right the exception happened because of The Date i've fixed it and it works,,
thanks for Gave me the solution

once more thanks

gb
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

You're welcome!
 
jQuery in Action, 2nd edition
 
subject: ORA-01858: a non-numeric character was found where a numeric was expected