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: update with condition

Re: update with condition

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Tue, 28 Aug 2001 19:11:27 +0200
Message-ID: <tonk68dojhue4e@news.demon.nl>


Did you read the question?
the OP was asking *without* PL/SQL!!!!!!

So it looks like I need to resolve this homework assignment.

update t1
set t1.f2 = (select t2.f2

                 from t2
                 where t2.f1 = t1.f1)

where exists
(select 'x'
 from t2
 where t2.f1 = t1.f1
 and t1.f3 > t2.f3
)

Regards,
Sybrand Bakker, Senior Oracle DBA

"CF" <new_at_flajolet.com> wrote in message news:9mgd79$sba$1_at_reader1.fr.uu.net...
> declare
> cursor cur_update is
> select t2.f1,t2.f2
> from t1,t2
> where t1.f1 = t2.f1
> and t1.f3 > t2.f3;
>
> begin
> for rec in cur_update loop
> update t1 set f2 = rec.f2
> where f1 = rec.f1;
> end loop;
> end;
> commit;
>
> Regards CF.
>
> "gil guerillot" <gil.guerillot_at_ratp.fr> a écrit dans le message news:
> 3B8BAF27.76E99DF9_at_ratp.fr...
> > I have 2 tables with 3 fields
> >
> > T1
> >
> > F1
> > F2
> > F3
> >
> >
> > T2
> >
> > F1
> > F2
> > F3
> >
> > the common key is F1
> > i want to update T1.F2 with the value of T2.F2
> >
> > but only when T1.F3 > T2.F3
> >
> > how can i do simply (SQL) wihtout PL/SQL ?
> >
> > thanks
> >
> >
> >
>
>
Received on Tue Aug 28 2001 - 12:11:27 CDT

Original text of this message

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