Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: executeUpdate always return 0
Precisely. In this case, executeUpdate() always returns Oracle error number,
which luckily happens to be ORA-00000: no error. :) You either need to add
an out parameter to receive result, or rewrite procedure as function that will
return updated rows count.
-- Vladimir Zakharychev (bob@dpsp-yes.com) http://www.dpsp-yes.com Dynamic PSP(tm) - the first true RAD toolkit for Oracle-based internet applications. All opinions are mine and do not necessarily go in line with those of my employer. "Mark D Powell" <mark.powell_at_eds.com> wrote in message news:178d2795.0208271024.ffe9ed9_at_posting.google.com...Received on Tue Aug 27 2002 - 13:41:51 CDT
> alonk_at_xor.co.il (Alon) wrote in message news:<ca2e4373.0208270611.4b3b79cd_at_posting.google.com>...
> > hi ,
> > i am running a simple stored procedure on oracle 8.1.7 from a java
> > application,
> > the update of the db works fine but the executeQuery() always return 0
> > even if it updated a column.
> > My java code is :
> > String stmt = (
> > "{call STP_UPDATE_MERCHANT_TERMINAL(?,?,?,?,?,?,?,?,?,?,?,?,?)}"
> > );
> >
> > CallableStatement cs = this.m_oConn.prepareCall(stmt);
> >
> > cs.setString(1, xmlFormObj.getValueByName("xxxx"));
> > cs.setString(2, xmlFormObj.getValueByName("yyyy"));
> > cs.setInt (3, xmlFormObj.getIntValue("xxxx"));
> > cs.setString(4, xmlFormObj.getValueByName("yyyy"));
> > cs.setInt (5, xmlFormObj.getIntValue("ttttt"));
> > cs.setString(6, xmlFormObj.getValueByName("uuuuu"));
> > cs.setString(7, xmlFormObj.getValueByName("jjjjjj"));
> > cs.setString(8, xmlFormObj.getValueByName("fffff"));
> > cs.setString(9, xmlFormObj.getValueByName("sssss"));
> > cs.setString(10,xmlFormObj.getValueByName("vvvvv"));
> > cs.setString(11,xmlFormObj.getValueByName("mmmmm"));
> > cs.setString(12,xmlFormObj.getValueByName("kkkkk"));
> > cs.setString(13,xmlFormObj.getValueByName("bbbbb"));
> >
> > int nResult = cs.executeUpdate();
> > System.out.println("Result : " + nResult );
> > cs.close();
> >
> > does any one have any ideas ,
> > Thanks in advanced
> > Alon
>
> Alon, I am not a JAVA coder but your code looks like it is executing
> an Oracle procedure call and the return code will always be 0 or an
> Oracle error number. If you want an updated row count you would need
> to add an out variable to the procedure and have the procedure put the
> number of rows updated into this variable.
>
> I could be wrong being this is JAVA but that is what this looks like
> to me.
>
> -- Mark D Powell --
![]() |
![]() |