This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques and have Mario Casciaro & Luciano Mammino on-line!
See this thread for details.
Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • 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
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Regarding reultset in stored procedures

 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible for stored provedure to return a resultset
and that too if it do not have any out parameters
if we use callable statment then also we cannot get resultset
and if we use preparedStatement then
prepared statement is not used for stored procedures
I was asked this question in an interview but cud not give a
satisfactory reply
another question which wasd asked from me was
that is it true that it is difficult to debug a stored procedure
pls reply if anyone knows it
 
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Gaurav Chikara:
Is it possible for stored provedure to return a resultset
and that too if it do not have any out parameters
if we use callable statment then also we cannot get resultset


it is possible to return a resultset from a callable statement in 2 ways:
1. as a return value from the callable statement

2. as an output parameter


another question which wasd asked from me was that is it true that it is difficult to debug a stored procedure


This depends. I have training as a Database Administrator as well as a programmer, so debugging stored procedures is as easy as debugging a java application. If you don't know how to read the stored procedure and you just call it, hoping for the best, it may be harder to debug.
 
Gaurav Chikara
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jamie Robertson:

2. as an output parameter



This depends. I have training as a Database Administrator as well as a programmer, so debugging stored procedures is as easy as debugging a java application. If you don't know how to read the stored procedure and you just call it, hoping for the best, it may be harder to debug.


Hi Jamie Robertson
since we know that execute method donot return anything
then how is it possbile that it will return a resultset as u mentioned
can u or anyone clrify it?
 
Gaurav Chikara
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jamie Robertson:

2. as an output parameter



This depends. I have training as a Database Administrator as well as a programmer, so debugging stored procedures is as easy as debugging a java application. If you don't know how to read the stored procedure and you just call it, hoping for the best, it may be harder to debug.


Hi Jamie Robertson
since we know that execute method donot return anything
then how is it possbile that it will return a resultset as u mentioned
can u or anyone clarify it?
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, this needs to be modified a little(was in a hurry Friday!):
If there are no input values for the StoredProcedure, only a return value of cursor/resultset then there is an example in the sun tutorial
here.
I believe if you use this code (not tested) it should work to:


Jamie
 
Yeah, but does being a ninja come with a dental plan? And what about this tiny ad?
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic