Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

simpleJdbcCall , org.springframework.jdbc.BadSqlGrammarException

 
sze sze chan
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I'm very new to java and spring frame work, and i'm currently working on a java code enhancement program
.
And i'm having some trouble when calling the oracle package.
any help will be much appreciated ! thanks
Below is the error occurs:




the error occurs when the package is called,
the package name stored as below:




and the package is called by using simpleJdbcCall:




the package generates and return a set_nbr and the error occurs at this line:



i'm wondering is there anyway to write this variable : String n_setNum = (String)sjc.executeFunction(Class.forName("java.lang.String"));
as Integer ?
because it is going to store in integer and call another class

 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That error occurs because the parameters you're trying to use to call the stored procedure don't match the parameters that are actually declared on the stored procedure - either it expects some "in" parameters you aren't providing, or the the "out" parameter is declared as a different type than "String".
 
sze sze chan
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nathan Pruett wrote:That error occurs because the parameters you're trying to use to call the stored procedure don't match the parameters that are actually declared on the stored procedure - either it expects some "in" parameters you aren't providing, or the the "out" parameter is declared as a different type than "String".


Hi, thank you for your reply!
are you saying that the String n_setNum = (String)sjc.executeFunction(Class.forName("java.lang.String")); is a different type as the "out" inside the oracle package?
is there anyway I can write String n_setNum = (String)sjc.executeFunction(Class.forName("java.lang.String")); as an integer ?
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could call it with java.lang.Integer to be able to cast it to an int... but what are the actual parameters defined on the stored procedure?
 
sze sze chan
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nathan Pruett wrote:You could call it with java.lang.Integer to be able to cast it to an int... but what are the actual parameters defined on the stored procedure?


Should be String in the stored procedure. I've tried to convert it into int but the error is still there
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, some more things to try -

You can try to specify the out parameter when you're creating the SimpleJdbcCall -



Second, I think supplying java.lang.Integer will attempt to cast the value returned to an Integer - but you can try to do this yourself to see if it's causing the problem -

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic