Re: foreach in pl/sql?

From: Scott Urman <surman_at_oracle.com>
Date: 1996/05/07
Message-ID: <4mnucp$rm_at_inet-nntp-gw-1.us.oracle.com>#1/1


In article <318DD608.2781E494_at_ariadne.it>, Piero Stanchi <stanchi_at_ariadne.it> writes:
|> Hi everybody!
|> I wonder if someone among you can help me. My problem is that I should
|> try a condition for each item of a long list of variables. The loop
|> structure in pl/sql allows only for a numeric range. Is the only way to
|> repeat the if code for all the elements in my list?
|> I thank you in advance.
|> --
|> Piero Dig Stanchi --- Ariadne S.r.l.
|> E-mail: stanchi_at_ariadne.it Web: http://www.ariadne.it
|> Phone&Fax: +39 382 407538/407225
|> Postal mail:
|> Via Campeggi 13 - 27020 Casottole di Torre d'Isola (PV) - Italy
Hmm - interesting question. You're right - PL/SQL has only a numeric looping structure, unless you can use a cursor. If you can put your list of variables into a database table, then you can loop over them and select only those in which you are interested by using the WHERE clause of the cursor SELECT statement.

-- 
------------------------------------------------------------------------
Scott Urman            Oracle Corporation           surman_at_us.oracle.com
------------------------------------------------------------------------
Author of "Oracle PL/SQL Programming", ISBN 0-07-882176-2
Published by Oracle Press - http://www.osborne.com/oracle/index.htm
------------------------------------------------------------------------
"The opinions expressed here are my own, and are not necessarily that of
 Oracle Corporation"
------------------------------------------------------------------------
Received on Tue May 07 1996 - 00:00:00 CEST

Original text of this message