try reading the JDBC docs at http://download-uk.oracle.com/otndoc/oracle9i/901_doc/java.901/a90211/toc.htm
pay attention to the "Oracle REF
CURSOR Type Category" section of chapter 5 and the "REF CURSORs--RefCursorExample.java" of chapter 20
(http://download-uk.oracle.com/otndoc/oracle9i/901_doc/java.901/a90211/samapp.htm#1016411)
hth,
Marin
----
"...what you brought from your past, is of no use in your present. When
you must choose a new path, do not bring old experiences with you.
Those who strike out afresh, but who attempt to retain a little of the
old life, end up torn apart by their own memories. "
----- Original Message -----
From: "Nandu Garg" <[EMAIL PROTECTED]>
To: "Multiple recipients of list ORACLE-L" <[EMAIL PROTECTED]>
Sent: Friday, March 22, 2002 09:13
Subject: Calling a Stored procedure from Java which returns
cursor value
>
> I was running following code in from this list only and I want to
> call it from java code. Code is
>
> CREATE OR REPLACE PACKAGE Apack AS
> TYPE RefCurTyp IS REF CURSOR;
> END APACK;
> /
>
> CREATE OR REPLACE PROCEDURE demo_ref (
> refcurvar IN OUT Apack.RefCurTyp,
> choice NUMBER) IS
> BEGIN
> IF choice = 1 THEN
> OPEN refcurvar FOR SELECT * FROM emp;
> ELSIF choice = 2 THEN
> OPEN refcurvar FOR SELECT * FROM dept;
> ELSIF choice = 3 THEN
> OPEN refcurvar FOR SELECT * FROM salgrade;
> END IF;
> END demo_ref;
> /
>
> The procedure above works very fine if I just execute it on SQL
> after declaring a refcursor variable x
> SQL> exec demo_ref(:x,2). BUT How to run this procedure from Java
> Code. I can use 'Call' statement in Java and ? ? as variables ,
> however what will replace :x on Oracle in Java file. I am still
> having problems in calling it from java. (I can convert it to
> function and then call it successfully from java , but I think
> there must be some way out in Java for calling SP)
>
> NG
>
> P.S. I can call SP from java which is accepting parameter but not
> returnin value.
>