Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> easy way for list processing with pl/sql?

easy way for list processing with pl/sql?

From: bmlam <bmlam_at_online.de>
Date: Tue, 20 Jul 1999 23:53:26 +0200
Message-ID: <3794EFD5.633E64A5@online.de>


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;

begin
  v_int_list(1):= 998;   -- this
  v_int_list(2):= 996;   --   is  a damned tedious way
  v_int_list(3):= 994;   --      to initialize a list
  for 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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US