| Author |
simpleJdbcCall , org.springframework.jdbc.BadSqlGrammarException
|
sze sze chan
Greenhorn
Joined: Jul 27, 2011
Posts: 18
|
|
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
Joined: Oct 18, 2000
Posts: 4121
|
|
|
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".
|
-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
|
 |
sze sze chan
Greenhorn
Joined: Jul 27, 2011
Posts: 18
|
|
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
Joined: Oct 18, 2000
Posts: 4121
|
|
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
Joined: Jul 27, 2011
Posts: 18
|
|
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
Joined: Oct 18, 2000
Posts: 4121
|
|
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 -
|
 |
 |
|
|
subject: simpleJdbcCall , org.springframework.jdbc.BadSqlGrammarException
|
|
|