Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL question
"Michael" <mikeeria_at_interia.pl> wrote in message news:875e251b.0404282110.61e39780_at_posting.google.com...
> Hi,
>
> Is it possible to write I) without using PL/SQL blocks. Something like II) ??
>
>
> I)
> DECLARE
> CURSOR MyCursor IS
> SELECT a, MAX(b)
> FROM table_name GROUP BY a;
> BEGIN
> FOR col_rec IN MyCursor
> LOOP
> UPDATE table_name SET c = 'Y'
> WHERE a = col_rec.a
> AND b = col_rec.b
> END LOOP;
> END;
>
> II)
> UPDATE table_name SET c = 'Y' WHERE
> a,b = (SELECT a,MAX(b) FROM table_name GROUP BY a);
>
>
> TIA
> Michal
Homework?
update tab set ...
where (a,b) IN (select a,max(b)......);
Anurag Received on Thu Apr 29 2004 - 00:23:30 CDT