​A selection of topics on IT and its application to finance. 
​Send me your comments, questions ​or suggestions by clicking
h​ere


elmama
Use a variable as an INLIST.

 

We use the Oracle TABLE function which "makes" its parameter e.g a comma separated list - "look" like a table.


Here is an example.


We first create a TYPE which will be our variables type


set serveroutput on


create or replace type instrtab is table of varchar2(2);

/


declare


x instrtab := instrtab('10', '20');


begin


for i in (


select empno,deptno


from scott.emp


where deptno in (


select column_value


from TABLE(x)))


loop


dbmsoutput.put_line(i.empno || '  ' || i.deptno);


end loop;


end;


SQL>/


7782             10

7839             10

7934             10

7499             30

7698             30

etc...