Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Oracle/OAS and the fly likes JRUN Oracle and Stored Procedures Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "JRUN Oracle and Stored Procedures" Watch "JRUN Oracle and Stored Procedures" New topic

JRUN Oracle and Stored Procedures

J Fideler

Joined: May 24, 2004
Posts: 1
I cannot find a single example in nature of an Oracle Stored Procedure that returns a set of results (i.e. select * from user) along with the java code that would read that set of results through a jdbc connection pool

Why is this such an obscure thing?? In the SQL Server world this is the normal way to do things and there are examples galore (simple ones!!)

What gives here? Or are stored procs simply not done in Oracle?

Please Help
Carl Trusiak

Joined: Jun 13, 2000
Posts: 3340
Ref Cursor

Getting a connection from a pool is the same for Oracle, MySQL, M$Sql etc. The only difference is the configuration of the pool to specify the DriverManager class.

I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17249

Moving this to the Oracle forum, since it is not a Servlets question.


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17249

Oracle and SQL Servers stored procedures work differently. In most cases SQL Server stored procedures are really just stored queries. Whereas in Oracle a stored procedure is actually a procedure of code. Meaning you can do many things, not necessarily getting data. Although in that case why make it a stored procedure on the back-end when you can move that type of code closer to where it is needed.

In Oracle to get a Result set back, you have to actually pass an empty result set to the procedure as an IN/OUT parameter. That is waht is called a ref cursor, or reference cursor.

Good Luck.

It is sorta covered in the JavaRanch Style Guide.
subject: JRUN Oracle and Stored Procedures
Similar Threads
Oracle stored procedures
Help with Resultset
How to pass Resultset as input parameter to a stored procedure ?
Oracle Stored Procedure
is there something called database programming