Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> easy way for list processing with pl/sql?
I know I can do the following:
declare
type int_tab is table of integer index by binary_integer;
v_int_list int_tab; v_cnt integer; v_empno integer; v_index binary_integer;
v_int_list(1):= 998; -- this v_int_list(2):= 996; -- is a damned tedious way v_int_list(3):= 994; -- to initialize a listfor v_index in 1 to v_int_list.count loop
v_empno:= v_int_list(v_index); select count(*) into v_cnt from emp where emp_no = v_empno;
Suppose the list v_int_list has some dozen elements, then the above way
of doing it will look really stupid.
What I would like to have is some thing much more simple, like :
for v_empno in (998, 996, 994) loop
select count(*) into v_cnt from emp where emp_no = v_empno;
But of course this does not work. The point is: is there a better pl/sql solution than the one first mentioned? Received on Tue Jul 20 1999 - 16:53:26 CDT
![]() |
![]() |