Hi,
I have a procedure that reads a tbl_A using cursor.
declare curs_A
select fld_A1, fld_A2,....
fld_A1 values can be A1, B1, B1, C1....
I would like to create another cursor (curs_B) for only certain records for fld_A1 when it meets some criteria.
For example
If fld_A1 = 'B1'
declare curs_B
select fld_B1 from tbl_B
where fld_B1 = fld_A1
It gives me error when it enters IF statement second time saying curs_B exists.
Is there anyway to separate declare cursor from select.
Can I put decalre outside of IF and select statement within IF statement?
I have a procedure that reads a tbl_A using cursor.
declare curs_A
select fld_A1, fld_A2,....
fld_A1 values can be A1, B1, B1, C1....
I would like to create another cursor (curs_B) for only certain records for fld_A1 when it meets some criteria.
For example
If fld_A1 = 'B1'
declare curs_B
select fld_B1 from tbl_B
where fld_B1 = fld_A1
It gives me error when it enters IF statement second time saying curs_B exists.
Is there anyway to separate declare cursor from select.
Can I put decalre outside of IF and select statement within IF statement?