Solved

Stored Procedure with multi OUTPUT parameters!

Posted on 2003-12-01
10
352 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
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 500 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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
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 …

724 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