Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 21st, 2005, 12:48 PM
adviner adviner is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 10 adviner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 30 m 6 sec
Reputation Power: 0
Retrieve multiple rows in stored procedure

I have a stored procedure that im trying to retrieve multiple rows.
The stored procedure is:

CREATE PROCEDURE SP_RETRIEVE_LISTINGS
RETURNS (
LISTINGID INTEGER,
LISTING VARCHAR(60))
AS
begin
/* Procedure Text */
for
select listing_id, listing from l_listings
into :listingid, :listing
do
begin
suspend;
end

end

When i run it in my IB Expert it pulls the 2 rows. But when i use it in my java code it only pulls the first one:

statement = connection().prepareCall("{execute SP_RETRIEVE_LISTINGS }");
result = statement.executeQuery();

items = new SelectItem[2];

while(result.next())
{
oId = TypeFormatter.getInteger(result, 1);
strList = TypeFormatter.getString(result, 2);

items[nLoop] = new SelectItem(oId.toString(), strList);
nLoop++;
}

I have changing the call to the stored procedure from call to execute without any success. It always just loops once. Any ideas on why it is hapenning?

Thanks

Reply With Quote
  #2  
Old September 22nd, 2005, 12:21 AM
badukist badukist is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 62 badukist User rank is Corporal (100 - 500 Reputation Level)badukist User rank is Corporal (100 - 500 Reputation Level)badukist User rank is Corporal (100 - 500 Reputation Level)badukist User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 13 h 3 m 18 sec
Reputation Power: 7
Send a message via Yahoo to badukist
Quote:
Originally Posted by adviner
I have a stored procedure that im trying to retrieve multiple rows.
The stored procedure is:

CREATE PROCEDURE SP_RETRIEVE_LISTINGS
RETURNS (
LISTINGID INTEGER,
LISTING VARCHAR(60))
AS
begin
/* Procedure Text */
for
select listing_id, listing from l_listings
into :listingid, :listing
do
begin
suspend;
end

end

When i run it in my IB Expert it pulls the 2 rows. But when i use it in my java code it only pulls the first one:

statement = connection().prepareCall("{execute SP_RETRIEVE_LISTINGS }");
result = statement.executeQuery();

items = new SelectItem[2];

while(result.next())
{
oId = TypeFormatter.getInteger(result, 1);
strList = TypeFormatter.getString(result, 2);

items[nLoop] = new SelectItem(oId.toString(), strList);
nLoop++;
}

I have changing the call to the stored procedure from call to execute without any success. It always just loops once. Any ideas on why it is hapenning?

Thanks


Try
connection().prepareCall("{select LISTINGID,LISTING from SP_RETRIEVE_LISTINGS }");

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Retrieve multiple rows in stored procedure


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT