Subject Re: [firebird-support] Miltiple rows in singleton select
Author dhay@lexmark.com
hi,

You need to have a loop in there to allow for multiple results.

so, try this:

PROCEDURE FACTURA_RELACION (
PE_ORDEN SMALLINT)
RETURNS (
PRO_PAI_NOMBRE VARCHAR(30),
FAC_NUMERO VARCHAR(20),
FAC_FECHA DATE,
PRO_NOMBRE VARCHAR(30),
FAC_TOTALIMPORTE NUMERIC(9,2))
AS
begin
if (pe_orden = 1) then
begin

FOR select pro_PAI_NOMBRE,
FAC_NUMERO,
FAC_FECHA,
PRO_NOMBRE,
FAC_TOTALIMPORTE from factura_v
order by pro_pai_nombre, FAC_FECHA
into :pro_PAI_NOMBRE,
:FAC_NUMERO,
:FAC_FECHA,
:pro_nombre,
:FAC_TOTALIMPORTE /** NO ; here!! **/
DO BEGIN
SUSPEND;
END
end

end

hth,

David





"Santiago" <gnajar@...> on 30/10/2003 02:59:04 PM

Please respond to firebird-support@yahoogroups.com

To: firebird-support@yahoogroups.com
cc:
Subject: [firebird-support] Miltiple rows in singleton select


Hi,

I have this stored procedure:

PROCEDURE FACTURA_RELACION (
PE_ORDEN SMALLINT)
RETURNS (
PRO_PAI_NOMBRE VARCHAR(30),
FAC_NUMERO VARCHAR(20),
FAC_FECHA DATE,
PRO_NOMBRE VARCHAR(30),
FAC_TOTALIMPORTE NUMERIC(9,2))
AS
begin
if (pe_orden = 1) then
begin

select pro_PAI_NOMBRE,
FAC_NUMERO,
FAC_FECHA,
PRO_NOMBRE,
FAC_TOTALIMPORTE from factura_v
order by pro_pai_nombre, FAC_FECHA
into :pro_PAI_NOMBRE,
:FAC_NUMERO,
:FAC_FECHA,
:pro_nombre,
:FAC_TOTALIMPORTE;

end

end

When I call it like:

select * from factura_relacion(1)

I get the following error:
"multiple rows in singleton select"

What does it mean? how can I fix it?


Thank you,
Guillermo



To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/