select ... for update

From: Jie Liang <jliang(at)ipinc(dot)com>
To:
Cc: pgsql-sql(at)postgresql(dot)org
Subject: select ... for update
Date: 2000-12-12 22:03:17
Message-ID: 3A36A0A5.E778EECA@ipinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> Hi,

How can I use select ... for update to update limit to update what I
select??
somewhat like:
select url,id from mytable for update order by priority,id limit 5;
I want update the id in above return like:
update mytable set allocatedto='whatever' where id in above return set.
Could I do it in one stmt.
And what is class_name in following:
SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ]
expression [ AS name ] [, ...]
[ INTO [ TEMPORARY | TEMP ] [ TABLE ] new_table ]
[ FROM table [ alias ] [, ...] ]
[ WHERE condition ]
[ GROUP BY column [, ...] ]
[ HAVING condition [, ...] ]
[ { UNION [ ALL ] | INTERSECT | EXCEPT } select ]
[ ORDER BY column [ ASC | DESC | USING operator ] [, ...] ]
[ FOR UPDATE [ OF class_name [, ...] ] ]
LIMIT { count | ALL } [ { OFFSET | , } start ]
can any one give me a example??

--
Jie LIANG

Internet Products Inc.

10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873

jliang(at)ipinc(dot)com
www.ipinc.com

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Luca Pregliasco 2000-12-12 23:50:40 Re: Persistent Connects (pg_pconnect)
Previous Message Borek Lupoměský 2000-12-12 21:57:20 Re: SQL parse error