Subject Re: [ib-support] stored procedure
Author Regina Phandu
well, it's true what Svein said:

Some tools may add quotes when declaring
tables something which makes everything case sensitive. If so, use
"tm_pos_product" in your select rather than tm_pos_product (the latter
equals "TM_POS_PRODUCT", and is different from "tm_pos_product").

I created the table using IBAccess. and it's true that i need to add " " .
So, the procedure should be like this:

set term !!;
create procedure sp_tot_prod_qty (prod_code integer)
returns (tot_prod_qty float)
declare variable qty_display float;
declare variable qty_warehouse float;
select "qty"
from "tm_pos_product"
where "prod_code" = :prod_code
into :qty_display;

select "qty"
from "tm_warehouse"
where "prod_code" = :prod_code
into :qty_warehouse;

tot_prod_qty=(qty_display + qty_warehouse);

end !!