java.sql.SQLException: ORA-01858: a non-numeric character was found where a numeric was expected
wu daly
Greenhorn
Joined: Aug 21, 2009
Posts: 7
posted
0
hi,
I executed such jsp as follows,but it throws error in this sentence:int i = stmt.executeUpdate(sql1);
the details of the error:
java.sql.SQLException: ORA-01858: a non-numeric character was found where a numeric was expected
Hi wu daly,
Welcome to JavaRanch You must be having numeric fields in the table but you are using all String variables to pass data in the update statement ?
And please use code tags when posting code, unformatted code is difficult to read.
And you should avoid using JDBC code in JSPs. Move them to Java class(es).
wu daly
Greenhorn
Joined: Aug 21, 2009
Posts: 7
posted
0
thanks,Vijitha Kumara.
According to the error provided by tomcat server,executeQuery() returns a int value,but now it returns a String value.I've checked this jsp for times,but i still cannot find where the mistake is.
by the way ,how to use code tags when posting code?i come to this forum for the first time.
wu daly wrote:According to the error provided by tomcat server,executeQuery() returns a int value,but now it returns a String value.
No I mean in your update SQL statement, check with the table (extract.tb_data_source) whether you have any numeric fields in there or post the datatypes used for the fields of that table. BTW executeUpdate returns an int.
And now you are seems to having a different error in the JSP. Were you able to resolve the previous error ? What changes you did to the page ? We should see the source then.
wu daly
Greenhorn
Joined: Aug 21, 2009
Posts: 7
posted
0
The main body of the jsp is on top of the page.Just now,i ran it on server,it still failed.
i have copy the mistake given by tomcat server to the page.
Please help me solve the problem.Thank you very much.
wu daly wrote:The main body of the jsp is on top of the page.Just now,i ran it on server,it still failed.
i have copy the mistake given by tomcat server to the page. Please help me solve the problem.Thank you very much.
You have few problems in the page. You are not handling the checked exceptions of JDBC code. You need try catch blocks around that code. I suggest you go through JDBC Tutorial to get those correct.
Ever heard of SQL injection attacks? If not, please read up on it, or your data will be destroyed. If so, I can't fathom why you're building the query like this.