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

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

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 February 25th, 2012, 11:29 AM
radialdes radialdes is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2012
Posts: 2 radialdes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 m 29 sec
Reputation Power: 0
Angry What is wrong ???

Hello friends.

I execute the folow simple query on IBExpert (FireBird 2.5) and this work fine:

SELECT
pd.NOME_PRODUTO,
es.QTDE_MINIMA
FROM
TBL_ESTOQUE es,
TBL_PRODUTO pd
WHERE
es.qtde_estoque = 0
AND es.produto = pd.id
ORDER BY
pd.NOME_PRODUTO

But, if i create one stored procedure with too output parameters ( see bellow )

begin
SELECT
pd.NOME_PRODUTO,
es.QTDE_MINIMA
FROM
TBL_ESTOQUE es,
TBL_PRODUTO pd
WHERE
es.qtde_estoque = 0
AND es.produto = pd.id
ORDER BY
pd.NOME_PRODUTO
into :nome_produto, :qtde_minima;
suspend;
end

I get one worng message like this:
" multiple rows in singleton select.
multiple rows in singleton select.
At proceddure 'SPD_SALDO_PROD_ZERADO_ESTOQUE' line: 7, col:3"

What is this? I don't understanding what happen????

Thank's a lot.

Reply With Quote
  #2  
Old February 26th, 2012, 02:44 PM
duilioisola duilioisola is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2012
Posts: 2 duilioisola User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 36 m 22 sec
Reputation Power: 0
Your select statment has more than 1 result and you have only one variable to set it.

You have more than une product with qtde_estoque=0

If you want a list of every product, you shoud use a "for select" statement:

Code:
 
CREATE PROCEDURE TEST (nome_produto varchar(15), qtde_minima integer)
BEGIN
  FOR SELECT
     pd.NOME_PRODUTO,
     es.QTDE_MINIMA
  FROM
     TBL_ESTOQUE es,
     TBL_PRODUTO pd
  WHERE
     es.qtde_estoque = 0
     AND es.produto = pd.id
  ORDER BY
     pd.NOME_PRODUTO
     into :nome_produto, :qtde_minima
 do
 begin
    /* This returns one record */
    suspend;
 end;
END;

Reply With Quote
  #3  
Old April 4th, 2012, 09:33 PM
radialdes radialdes is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2012
Posts: 2 radialdes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 m 29 sec
Reputation Power: 0
Thank you my friend.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > What is wrong ???

Developer Shed Advertisers and Affiliates



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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap