• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Need Help - Emergency

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a java program which sends to Oracle as parameter an method(Array[], Array[], String, Number) and returns the results set as an object, which I have to loop in my java program to display it. Could anyone tell me how to call this method in java and how to receive the results in an object from pl/sql. Thanks.
I have started with this, could anyone tell me if I'm doing it right and correct my program.
StructDescriptor desc1=StructDescriptor.createDescriptor("RECTYPE",ora._con);
STRUCT p1struct = new STRUCT(desc1, ora._con, p1obj1);
STRUCT p2struct = new STRUCT(desc1, ora._con, p1obj2);
OracleCallableStatement ocs = (OracleCallableStatement )
ora._con.prepareCall("{call " +
"pegasustypes.show_pegasus(?,?," +
ownerid + ", " + num + ")}");
ocs.setOracleObject(1, p1struct);
ocs.setOracleObject(2, p2struct);
ocs.registerOutParameter(1,OracleTypes.STRUCT,"RECTYPE");
ocs.registerOutParameter(2,OracleTypes.STRUCT,"RECTYPE");
ocs.registerOutParameter(3,OracleTypes.CURSOR);
ocs.execute();
p1struct = ocs.getSTRUCT(1);
p2struct = ocs.getSTRUCT(2);
Object [] p1obj = p1struct.getAttributes();
Object [] p2obj = p2struct.getAttributes();
ora._rs=(ResultSet)ocs.getObject(1);
for(int k = 0; k < infos.length; k++){
System.out.println(ora._rs.getString("pegasus_id").toString());
System.out.println("Record: " + p1obj[k] + " " + p2obj[k]);
}
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic