Q: PL*SQL stored procedure, oracle objects and Java
From: Abraham Leolo (abraham.leolo_at_nospam.org)
Date: 12/14/03
- Next message: Scott Robert Ladd: "Jisp 3.0 - A Small Open Source Database Engine"
- Previous message: Mike: "Re: @@IDENTITY correct syntax?"
- Next in thread: Bjorn Abelli: "Re: PL*SQL stored procedure, oracle objects and Java"
- Reply: Bjorn Abelli: "Re: PL*SQL stored procedure, oracle objects and Java"
- Reply: Jeff Smith: "Re: PL*SQL stored procedure, oracle objects and Java"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 14 Dec 2003 21:43:59 GMT
Hello,
I've googled hours for detailed information on this topic, but both the
Oracle technical network as well as Google have let me down.
The situation is that I get a resultset (a cursor) from a stored
procedure, but this resultset (a nested table) contains objects created
in PL*SQL.
My question is simple, how to access these objects within the resultset
from Java ?
---
Example:
Calling a PL*SQL stored procedure from Java just like this, which in
this example returns a simple address as string.
// Declare the callable statement
CallableStatement cstmt;
// Declare the command syntax with placeholders
String command = "{call PERSMGT.GETADDRESS(?)}";
// Make the command into a callable statement
cstmt = con.prepareCall(command);
// Initialize command variables
cstmt.registerOutParameter(1, Types.VARCHAR);
// Execute the command
cstmt.execute();
// Retrieving Stored Procedure results
String address = cstmt.getString(1);
// Close the Callable Statement
cstmt.close();
My question is how to access the returned address(es) if the returned
result is not VARCHAR but a nested table of objects like the one shown
below.
CREATE TYPE Address AS OBJECT (
AddrStreet Varchar2(50),
AddrCity Varchar2(30),
AddrZip Number,
AddrCountry Varchar2(10) );
Which type of cstmt.registerOutParameter() is this, and after execution,
how do I access this nested table WITH objects in it? My real problem is
to access the objects within the result. Does anybody know how to do
that? A complete example and source would be very helpful. Thanks in
advance.
Cheers
Abraham
- Next message: Scott Robert Ladd: "Jisp 3.0 - A Small Open Source Database Engine"
- Previous message: Mike: "Re: @@IDENTITY correct syntax?"
- Next in thread: Bjorn Abelli: "Re: PL*SQL stored procedure, oracle objects and Java"
- Reply: Bjorn Abelli: "Re: PL*SQL stored procedure, oracle objects and Java"
- Reply: Jeff Smith: "Re: PL*SQL stored procedure, oracle objects and Java"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|