• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

stored procedure in sybase that returns 1 output parameter and return code

 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gurus,
I have a stored procedure for sybase. It takes 3 input parameters and returns 1 error code and 1 output parameter.

Can anybody please give me the syntax for calling this stp from CallableStatement and viewing the return and output parameters.

Thanks,
Martin
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Martin,
Sun has an example with the sample syntax.
 
Martin Lira
Ranch Hand
Posts: 97
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeanne,
Thanks for sending me the link, I looked at the ex usage of Callable but it only has 1 OUT parameter. Correct my syntax if the stp is returning a return code.
CallableStatement cs =
con.prepareCall("{? = call accountlogin(?,?,?)}");
cs.registerOutParameter(1, Types.INTEGER) //return code
cs.setString(2,theuser);
cs.setString(3,password);
cs.registerOutParameter(4,Types.DATE);

cs.executeQuery();
int return_code = cs.getInt(1);
Date lastLogin = cs.getDate(4);

thanks,
ML
[ July 28, 2004: Message edited by: Martin Lira ]
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Martin,
Your example, shows one out parameter and one return value. If that is what your stored procedure does, it is correct.

This page shows the difference between parameters and return values.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Very helpfull post, thanks!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic