• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

simpleJdbcCall , org.springframework.jdbc.BadSqlGrammarException

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 -

 
reply
    Bookmark Topic Watch Topic
  • New Topic