Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Stored Procedure with multi OUTPUT parameters!

Posted on 2003-12-01
10
Medium Priority
?
356 Views
Last Modified: 2010-05-18
A stored procedure in Microsoft SQL Server 2000 can have parameters and OUTPUT parameters.
I want to get all the OUTPUT parameters back in my Java program.
Please help! Thanx.
0
Comment
Question by:tinh911
  • 5
  • 5
10 Comments
 
LVL 92

Expert Comment

by:objects
ID: 9856432
Register each of them with registerOutParameter()
0
 

Author Comment

by:tinh911
ID: 9856447
Please tell me more.
Your answer is too short.
0
 

Author Comment

by:tinh911
ID: 9856459
May be some sample line of code is good!
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 92

Expert Comment

by:objects
ID: 9856464
sorry :-)

CallableStatement s = c.prepareCall("{call my_sp[(?, ?)]}");
s.registerOutParemater(1, Types.FLOAT);
s.registerOutParemater(2, Types.INTEGER);
0
 

Author Comment

by:tinh911
ID: 9856493
Yes, it's great, how can I put the OUTPUT parameter in a variable, for example INTEGER myInt. Can I write like this:
myInt = s.someMethod();//to put the OUTPUT parameter in myInt
0
 
LVL 92

Accepted Solution

by:
objects earned 2000 total points
ID: 9856511
Sorry again, you access them the same way you access any statement parameters:

int x = s.getInt(1);
float f = s.getFloat(2);

0
 

Author Comment

by:tinh911
ID: 9856518
Thank, you're certainly the one get my points!
Thanks again! :-)
0
 
LVL 92

Expert Comment

by:objects
ID: 9856631
Sorry I needed prodding :)

http://www.objects.com.au
0
 

Author Comment

by:tinh911
ID: 9856643
What site is it?
0
 
LVL 92

Expert Comment

by:objects
ID: 9856661
Thats my business, primarily doing Java consulting.
0

Featured Post

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn different types of Android Layout and some basics of an Android App.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question