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: Limit UPDATE statements to affect only one row

Re: Limit UPDATE statements to affect only one row

From: Serge Rielau <srielau_at_ca.ibm.com>
Date: Fri, 11 Aug 2006 09:24:25 -0400
Message-ID: <4k3embFa5tliU1@individual.net>


Here are a couple of wild guesses:

UPDATE emp SET sal = 1 WHERE rownum <= 1

doesn't work? try this:

UPDATE (SELECT sal FROM emp WHERE rownum <= 1) AS U SET sal = 1

still doesn't work? Try this:

UPDATE (SELECT ROW_NUMBER() OVER() AS rn, sal FROM emp) AS U

   SET sal = 1 WHERE rn = 1

That's what I'd try anyway..
Cheers
Serge

-- 
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

IOD Conference
http://www.ibm.com/software/data/ondemandbusiness/conf2006/
Received on Fri Aug 11 2006 - 08:24:25 CDT

Original text of this message

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