Skip site navigation (1) Skip section navigation (2)

UPDATE ... CURRENT OF cursorname

From: "Richard Broersma" <richard(dot)broersma(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: UPDATE ... CURRENT OF cursorname
Date: 2008-09-01 17:11:03
Message-ID: 396486430809011011s2bc0b35eh43b2e4a9de116a4a@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
I looking for an explination of how named cursor updates actually
work.  For example from the following link:
http://java.sun.com/javase/6/docs/technotes/guides/jdbc/getstart/resultset.html


the code seems to imply that all rows from a name cursor will be update.

...
stmt.setCursorName("x");
ResultSet rs = stmt.executeQuery(
		"SELECT . . . FROM . . . WHERE . . . FOR UPDATE . . .")
String cursorName = rs.getCursorName;
int updateCount = stmt2.executeUpdate(
		"UPDATE . . . WHERE CURRENT OF " + cursorName);
...

However from the postgresql manual, the verbase seems to indicate that
only the record currently pointed to in the cursor is updated.
http://www.postgresql.org/docs/8.3/interactive/sql-update.html

...
cursor_name
The name of the cursor to use in a WHERE CURRENT OF condition. The
->row<-  to be updated is the one most recently fetched from this
cursor.
...

-- 
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug

Responses

pgsql-jdbc by date

Next:From: Oliver JowettDate: 2008-09-01 22:21:39
Subject: Re: UPDATE ... CURRENT OF cursorname
Previous:From: Pushker ChaubeyDate: 2008-09-01 15:01:05
Subject: Table Alias posing problem in Update statements

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group