I'm fairly new to PL/SQL so please bear with my descriptions and terminology!
I have a procedure where I'm trying to process a choice of 2 cursor depending on an input parameter. So, I have 2 cursors, cA and cB (both of which output the same number of columns and types, cA returns a single row, cB is multiple rows).
So far I've been coming up with something like this, but I know it isn't right
I'm trying to avoid duplication of code by having 2 separate procedures for each cursor, but it seems that this should be quite easy to achieve (and I'm sure it is!)
Thanks
I have a procedure where I'm trying to process a choice of 2 cursor depending on an input parameter. So, I have 2 cursors, cA and cB (both of which output the same number of columns and types, cA returns a single row, cB is multiple rows).
So far I've been coming up with something like this, but I know it isn't right
Code:
procedure call_cursor(p_input in varchar2)
cursor cA is...
cursor cB is...
begin
if p_input = 'x' then
for rRecord in cA loop
elsif p_input = 'y' then
for rRecord in cB loop
....
....
....
end loop;
end if;
I'm trying to avoid duplication of code by having 2 separate procedures for each cursor, but it seems that this should be quite easy to achieve (and I'm sure it is!)
Thanks