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 -> Re: Simple FOR loop

Re: Simple FOR loop

From: Alex Filonov <afilonov_at_yahoo.com>
Date: 8 Apr 2003 08:26:42 -0700
Message-ID: <336da121.0304080726.1e97bb6a@posting.google.com>


knut_meidal_at_email.com (Knut E. Meidal) wrote in message news:<64c6c1ea.0304041323.2b905125_at_posting.google.com>...
> Using Oracle 9.0.1, this is what I want to do:
> * Create a simple loop iterating over a set of date values
> * Inside loop, run an update of a table, using the loop variable as where
> clause item.
>
> I'm using SQL Navigator for doing this, but it will be put in a stored
> procedure onvce I figure this out.
> I'm not really able to create this in an easy way, which I hoped. I hoped to
> do it using a simple FOR loop, and avoid some cursor programming (since I'm
> not really a PL/SQL programmer)
>
> I've been trying something like this:
>
> declare l_dateval date;
>
> for l_dateval in (select distinct date_col from slv) loop
> update slv
> set slv.settledayhist = (select s.settleday from statement s where s.id
> = slv.setl_id)
> where slv.settleday = to_date('27.02.2003', 'DD.MM.RRRR')
> and slv.settledayhist IS NULL;
> end loop;
>

I don't see why you need a loop here. I just don't see the loop parameter anywhere inside the loop. Looks like you don't need a loop, just run your update statement as is.

> Any insights? Can it be done?
>
> Thanks in advance
> Knut
Received on Tue Apr 08 2003 - 10:26:42 CDT

Original text of this message

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