*
The moose likes JDBC and the fly likes Calling Oracle Stored Procedure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Calling Oracle Stored Procedure" Watch "Calling Oracle Stored Procedure" New topic
Author

Calling Oracle Stored Procedure

Mike Firkser
Ranch Hand

Joined: Oct 21, 2003
Posts: 247

Any help will be appreciated. I'm getting nowhere on this. Oracle10 with Weblogic Server.

This proc works when accessing through Crystal Reports.

First the proc spec:



Now my Java code:




The results I'm getting is:
SQLException line 44: java.sql.SQLException: ORA-06553: PLEASE-306: wrong number or types of arguments in call to 'LAB_ORG_LISTING'

For some reason I can't put in P L S (without spaces) so I put in PLEASE


If I change the registerOutputparameter to

I get:

SQLException line 44: java.sql.SQLException: Cannot perform fetch on a PLSQL statement: next


Thanks,

Mike


Mike Firkser
Rutgers '84
Siva Masilamani
Ranch Hand

Joined: Sep 19, 2008
Posts: 385
In your procedure "lab_org_cur" is not just OUT parameter,it is IN also which means you need to send the cursor type as input.

You store procedure expects 4 input parameter but only 3 have been provided in your code.


SCJP 6,SCWCD 5,SCBCD 5

Failure is not an option.
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2497
    
    8

And this piece is not completely as per specs and tutorial.

I don't see your "{}".


OCUP UML fundamental and ITIL foundation
youtube channel
Mike Firkser
Ranch Hand

Joined: Oct 21, 2003
Posts: 247

I can't seem to find any method to set the parameter type as an INOUT type. I just see registerOutParameter.
Mike Firkser
Ranch Hand

Joined: Oct 21, 2003
Posts: 247

Looks like I got it working!!!

Thanks for your help.

Mike
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2497
    
    8

Mike,

Can you share your solution with us? It might help future Ranchers that have similar issues.
Mike Firkser
Ranch Hand

Joined: Oct 21, 2003
Posts: 247

Here is my final code with some comments:

Again, thanks for all your help.

Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2497
    
    8

Thank you!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Calling Oracle Stored Procedure