create table pids
(id number, name varchar2(15))
/
insert into pids values (1, 'PTEST1');
insert into pids values (2, 'PTEST2');
insert into pids values (3, 'PTEST3');
create or replace procedure numlist (p_num varchar2) is
cursor curt is
select *
from pids
where id in (p_num);
begin
for curtr in curt
loop
dbms_output.put_line('Name is ' || curtr.name);
end loop;
end;
/
when executed, it's giving error which is valid. How to convert a string to a number list.
SQL> exec numlist('1,2');
BEGIN numlist('1,2'); END;
*
ERROR at line 1:
ORA-01722: invalid number
ORA-06512: at "TSEC.NUMLIST", line 8
ORA-06512: at line 1