Results 1 to 4 of 4
Like Tree1Likes
  • 1 Post By Tolls

Thread: SQL EXception- in Stored Procedure call

  1. #1
    Join Date
    Feb 2012
    Posts
    14
    Rep Power
    0

    Question SQL EXception- in Stored Procedure call

    HI all,

    I am calling stored procedure using callable statement and passing arugument as string like this 1,4,5,5,5,6,7,7,7,7,7,7,65..l..etc.

    stored procedure is working fine in DB. I executed in DB with dynamic values.

    String eventparam=strParam.substring(0, strParam.length()-1);
    System.out.println("String is "+ eventparam);

    String query="event_notes("+eventparam+")";
    //String query = "CALL HI()";

    cs = con.prepareCall(query,ResultSet.TYPE_SCROLL_INSENS ITIVE,ResultSet.CONCUR_UPDATABLE);

    rs = cs.executeQuery();



    below exception is giving


    java.sql.SQLException: Procedure or function event_notes has too many arguments
    specified.
    at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnos tic(SQLDiagnostic.j
    ava:368)
    at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(Td sCore.java:2820)
    at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCor e.java:2258)
    at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(T dsCore.java:632)
    at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL Query(JtdsStatement
    .java:477)
    at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.ex ecuteQuery(JtdsPrep
    aredStatement.java:779)
    at org.apache.jsp.Notes_jsp._jspService(Notes_jsp.jav a:355)
    at org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:98)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:803)
    at org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper
    .java:331)
    at org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:3
    29)
    at org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:265)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:803)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(Appl
    icationFilterChain.java:269)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationF



    Thanks in advance

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,755
    Rep Power
    19

    Default Re: SQL EXception- in Stored Procedure call

    Exactly as the error says.
    You have too many parameters for the procedure.

    What is the signature of the procedure?

    And why are you concatenating your call and not using the setXXX() methods?

  3. #3
    Join Date
    Feb 2012
    Posts
    14
    Rep Power
    0

    Cool Re: SQL EXception- in Stored Procedure call

    Hi,

    Thanks for Replying.

    I got resolution for this . thanks.just mistake in storedprocedure calling

    String query="event_notes("+eventparam+")";

    should be
    String query="event_notes('"+eventparam+"')";

    Cheers!

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,755
    Rep Power
    19

    Default Re: SQL EXception- in Stored Procedure call

    Which wouldn't have happend if you had used setString(), as you're supposed to.
    DarrylBurke likes this.

Similar Threads

  1. java call stored procedure
    By namalsera in forum JDBC
    Replies: 1
    Last Post: 01-04-2011, 03:53 PM
  2. Debug mySql stored procedure
    By ulix83 in forum NetBeans
    Replies: 0
    Last Post: 10-29-2009, 11:48 AM
  3. How to call Oracle stored procedure from Java?
    By parag_narkhede in forum New To Java
    Replies: 4
    Last Post: 10-07-2009, 07:50 AM
  4. stored procedure
    By sankarigopi in forum JDBC
    Replies: 1
    Last Post: 11-13-2008, 04:53 PM
  5. How to get multiple rows from Stored Procedure
    By SRJ1957 in forum Advanced Java
    Replies: 0
    Last Post: 08-11-2008, 08:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •