There is a problem executing this block of code while passing the parameter. Parameter rf is a list of variables to be input into the WHERE clause. The number of variables to be input is not static.
create or replace
procedure test_pl(rf in varchar2)
IS
counter number;
BEGIN
select count(*) into counter from test_pl_imp where column_name in (rf);
dbms_output.put_line(counter);
END;
The execution code is as follows:
declare
inparam varchar2(20) := 'xyz,ran,dom';
begin
goku.test_pl(inparam);
end;
/
I want the WHERE condition to be executed like :
where column_name in ('xyz','ran','dom');
But it gets executed considering xyz,ran,dom as a string itself.
Is there any way to achieve it?
You can either explode the string out or the simplest way would be to use INSTR.
If you have the option to redesign this slightly, I think it would be a cleaner design to take an array of strings and you casting it to a TABLE so that you can join to test_pl_imp.
This could be done as follows:
And then your package spec would including the following since you want the types and procedures public for the above call:
And your package body would be something like the following: