Re: How do I get an OUT parameter ref cursor from Oracle?

From: Mark Wagoner <mwagoner_at_iac.net>
Date: Tue, 14 May 2002 19:30:21 -0400
Message-ID: <abs6md$2qc2$1_at_genma.iac.net>


You were close, use stm.getCursor(1)

"jw" <<jw_nyc_at_yahoo.n0sp4m.com> wrote in message news:abs1o302ql_at_drn.newsguy.com...
> I have an Oracle stored proc that looks like:
>
> create or replace procedure GetMyStuff(myID in varchar2, myOut OUT
> types.cursorType)
> -- types.cursorType is defined as a ref cursor
>
> is begin
>
> open myOut for
> select * from mytable where id = myID;
>
> end;
>
> What is does the Java code look like to get the ref cursor? I can get a
 ref
> cursor returned by a function but now need to use an out paramter. I"ve
 this:
>
> Connection con = DriverManager.getConnection(url, user, passw);
> Statement st = con.createStatement();
> CallableStatement stm = con.prepareCall("{call GetMyStuff ?, ? )}");
 //oracle
> stm.setString(1,"MY1234");
> stm.registerOutParameter(2,OracleTypes.CURSOR); //oracle
> boolean ans = stm.execute();
> ResultSet rs = (ResultSet) stm.getObject(1); //oracle
>
>
> but this isn't right. What am I doing wrong?
>
> Thanks in advance
>
> jw
>
Received on Wed May 15 2002 - 01:30:21 CEST

Original text of this message