Hi
I have to get a code for a given id passed to the cursor. There can be multiple id's that could be passed - was thinking a loop will work for that. My code is somewhat like:
declare
CURSOR MY_CUR(C_IDS varchar2) IS
SELECT DISTINCT CD as a FROM test1 WHERE idd in (''||c_IDS||'');
rec_t MY_CUR%rowtype;
lp_CD varchar2(30);
begin
open MY_CUR('1123456');
loop
fetch MY_CUR into rec_t;
if rec_t.a = 'A123' then
lp_CD := 'A123';
else
lp_CD := 'NONE';
end if;
exit when MY_CUR%notfound;
end loop;
end;
/
My question is:
1) How can I pass multiple parameters to the cursor and get the code back for those?
2) How can i test the code above without hardcoding the id?