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

Home -> Community -> Usenet -> c.d.o.server -> Re: How to update multiple rows having WHERE clause?

Re: How to update multiple rows having WHERE clause?

From: Jonathan Gennick <jonathan_at_gennick.com>
Date: Sat, 11 Sep 1999 03:28:17 GMT
Message-ID: <37d9be36.8742941@netnews.worldnet.att.net>


On Fri, 10 Sep 1999 20:08:03 GMT, bkrishnaiyer_at_refco.com wrote:

>Ex: I want to set cololumn1 values of table1 with column1 values of
>table2.

If I understand what you want correctly, you should be able to do something like this:

update table1

	set table1.column1 = (
		select table2.column1
		from table2
		where table2.primarykey=table1.primarykey);

The subquery will be executed once for each row in table1 that you update.

Jonathan



jonathan_at_gennick.com
http://gennick.com
Brighten the Corner Where You Are Received on Fri Sep 10 1999 - 22:28:17 CDT

Original text of this message

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