I get error:
SQL0504 35 23 Position 10 Cursor C1 not declared.
-- *****************************************************************************
-- ** Program: get_jobqty **
-- ** Description: Get Job Quantities by Cost Code - File F0902LC **
-- *****************************************************************************
create procedure get_jobqty
(in @jobnumber char(12))
result set 1
language sql
reads sql data
begin
declare c1 scroll cursor with return for
select gbsub, DECIMAL(SUM(gban01 + gban02 + gban03 +
gban04 + gban05 + gban06 + gban07 + gban08 +
gban09 + gban10 + gban11 + gban12 + gban13 +
gban14)/FLOAT(100.00),38,2) as sum_qty, gmdl01 as itemname
from vgiprddta/f0902lc left outer join vgiprddta.f0901jb
on vgiprddta.f0902lc.gbmcu = vgiprddta.f0901jb.gmmcu
where
vgiprddta.f0902lc.gblt = 'AU' and
vgiprddta.f0902lc.gbobj = ' ' and
vgiprddta.f0901jb.gmpec = 'N'
GROUP BY gbsub;
open c1;
set result sets cursor c1;
end;
SQL0504 35 23 Position 10 Cursor C1 not declared.
-- *****************************************************************************
-- ** Program: get_jobqty **
-- ** Description: Get Job Quantities by Cost Code - File F0902LC **
-- *****************************************************************************
create procedure get_jobqty
(in @jobnumber char(12))
result set 1
language sql
reads sql data
begin
declare c1 scroll cursor with return for
select gbsub, DECIMAL(SUM(gban01 + gban02 + gban03 +
gban04 + gban05 + gban06 + gban07 + gban08 +
gban09 + gban10 + gban11 + gban12 + gban13 +
gban14)/FLOAT(100.00),38,2) as sum_qty, gmdl01 as itemname
from vgiprddta/f0902lc left outer join vgiprddta.f0901jb
on vgiprddta.f0902lc.gbmcu = vgiprddta.f0901jb.gmmcu
where
vgiprddta.f0902lc.gblt = 'AU' and
vgiprddta.f0902lc.gbobj = ' ' and
vgiprddta.f0901jb.gmpec = 'N'
GROUP BY gbsub;
open c1;
set result sets cursor c1;
end;