Hardy Merrill said: > Kristian Nielsen [EMAIL PROTECTED] wrote: >> Could you briefly explain what an INSERT/UPDATE cursor is? > > I also don't know what an INSERT/UPDATE cursor is.
I know how a SELECT cursor works, but INSERT/UPDATE seems voodoo to me. My current PostgreSQL session doesn't seem to like it too much, either. It can't parse INSERT or UPDATE after CURSOR FOR. I looked in my PostgreSQL reference book, and I don't see a thing on it.
Would anyone care to elaborate on the INSERT/UPDATE cursor? I can't seem to wrap my head around how it would work, seeing as there wouldn't really be a result set to traverse, like there is with a SELECT cursor.
<teachGrandmother> SELECT blah FOR UPDATE { OF col, col, ... }
Prepare and execute
read cursor_id from statement handle
Fetch Loop {
processing
UPDATE table SET col = blah WHERE CURRENT OF cursor_id
or
DELETE FROM table blah WHERE CURRENT OF cursor_id
}(aka POSITIONED UPDATE | DELETE - See 'A Guide to The SQL Standard' 4th Edition, CJ Date with Hugh Darwen)
INSERT cursor is a contradiction of terms </teachGrandmother>
HTH -- MarkT
========================= E M Thornber CEng MIEE Enchanted Systems Limited Software Toolsmiths +44 (0) 1503 272097
