From a9545b3aef0d41fdb84bc6a30fa2e563020acad2 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 11 Jun 2007 22:22:42 +0000 Subject: Improve UPDATE/DELETE WHERE CURRENT OF so that they can be used from plpgsql with a plpgsql-defined cursor. The underlying mechanism for this is that the main SQL engine will now take "WHERE CURRENT OF $n" where $n is a refcursor parameter. Not sure if we should document that fact or consider it an implementation detail. Per discussion with Pavel Stehule. --- doc/src/sgml/plpgsql.sgml | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'doc/src') diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml index 855b05c0ef8..18ba19dd776 100644 --- a/doc/src/sgml/plpgsql.sgml +++ b/doc/src/sgml/plpgsql.sgml @@ -1,4 +1,4 @@ - + <application>PL/pgSQL</application> - <acronym>SQL</acronym> Procedural Language @@ -2614,6 +2614,31 @@ MOVE direction { FROM | IN } < MOVE curs1; MOVE LAST FROM curs3; MOVE RELATIVE -2 FROM curs4; + + + + + + <literal>UPDATE/DELETE WHERE CURRENT OF</> + + +UPDATE table SET ... WHERE CURRENT OF cursor; +DELETE FROM table WHERE CURRENT OF cursor; + + + + When a cursor is positioned on a table row, that row can be updated + or deleted using the cursor to identify the row. Note that this + only works for simple (non-join, non-grouping) cursor queries. + For additional information see the + + reference page. + + + + An example: + +UPDATE foo SET dataval = myval WHERE CURRENT OF curs1; -- cgit v1.2.3