Subject Resultset from stored procedures
Author Rocky Castaneda
Im using the latest alpha version of Firbird 2.0

I tried executing a stored procedure which basically
returns a resultset using Jaybird but

I get the following error 'error getting data'.

I tried to execute the procedure using IBConsole i did
not get any errors.

I then tried reverting to Firebird 1.5 and it went
fine.

For your reference, below is my stored procedure:

-------------------------------------------------
CREATE PROCEDURE SP_ENTITY_LEDGER
RETURNS (
ENTITYTYPE VARCHAR(10),
TRANS_DATE DATE,
ENTITYID BIGINT,
INVOICE_NUM VARCHAR(20),
TRANSTYPE VARCHAR(100),
AMOUNT NUMERIC(18,4),
DISCOUNT NUMERIC(18,4))
AS
BEGIN
FOR
select

(
select ee.entity_type from tb_entity ee
where im.entityid = ee.entityid
) ENTITYTYPE,

im.trans_date, im.entityid, im.invoice_num,
cast(im.transtype as Varchar(100)) as TRANSTYPE,

(select sum(id.qty_i * uprice) from
tb_invoicedtl id
where im.invoiceid = id.invoiceid
) -
(select sum(id.qty_o * uprice) from
tb_invoicedtl id
where im.invoiceid = id.invoiceid
) as AMOUNT,


(select sum(id.qty_o * (id.uprice *
(im.discount/100) )) from tb_invoicedtl id
where im.invoiceid = id.invoiceid
) as DISCOUNT

from tb_invoicemaster im

union

select

(
select ee.entity_type from tb_entity ee
where r.entityid = ee.entityid
) ENTITYTYPE,

r.trans_date, r.entityid, r.ornum,
cast('RECEIPTS' as varchar(100)) TRANSTYPE, r.amount
as AMOUNT, 0.00

from tb_receipts r

INTO :ENTITYTYPE,
:TRANS_DATE,
:ENTITYID,
:INVOICE_NUM,
:TRANSTYPE,
:AMOUNT,
:DISCOUNT
DO
BEGIN
if (AMOUNT < 0 and TRANSTYPE <> 'RECEIPTS') then
AMOUNT = AMOUNT * -1;
/*if (AMOUNT < 0 and TRANSTYPE = 'RECEIPTS') then
AMOUNT = AMOUNT * -1;*/
SUSPEND;
END
END
-----------------------------------------------------

All the best,

rocky

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com