• 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:
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • Carey Brown
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • fred rosenberger
  • salvin francis

does a procedure returns cursor, if so, how to hadle that in java

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
can we send a cursor from procedure. if so, how to handle that cursor in java. please help me.

Thank u.
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Praveen,

A cursor can be used as an out parameter in a procedure.If you want that cursor to be handled in Java then use CallableStatement.

ArrayList cursor1 = new ArrayList();
CallableStatement cst = connection.prepareCall("{call YourProc(?,?)}");
cst.setString(1,in_param);
cst.registerOutParameter(2,oracle.jdbc.driver.OracleTypes.CURSOR);
cst.execute();
cursor1 =(ResultSet)cst.getObject(2);

Where YourProc as one in param and one out param which is a cursor and store that cursor in an arraylist to use the data available in it

Regards,
Sujith
 
Praveen palukuri
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank u sujith,
Here i'm using SqlServer. in this i couldn't find any datatype like cursor. so would u please tell me how to achieve using sqlserver
 
Sujith Kanaparthi
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Here i'm using SqlServer.


Sorry Praveen I have never worked on sql server

Regards,
Sujith
 
You showed up just in time for the waffles! And this 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