Updating cursors - Mailing list pgsql-general

From Jarmo Paavilainen
Subject Updating cursors
Date
Msg-id 000701c01640$8f706640$1501a8c0@theboss.comder.private
Whole thread Raw
Responses RE: Updating cursors
Re: Updating cursors
List pgsql-general
Hi,

Ive a SELECT cursor which I want to update/delete but postgresql does not
support these:

UPDATE myTable SET myColumn = 'myValue' WHERE CURRENT OF myCursor
DELETE myTable WHERE CURRENT OF myCursor

Does there exist any workaround?
Or is my syntax wrong?

One workaround would be to get the row id and to be able to update it.
Something like this:

... a row is selected and fetched ...

int i = GetRowId( ); // C function that reads a unique row id.
ExecuteSQL( "UPDATE myTable SET myColumn = 'myValue' WHERE @ROWID = %d",
i );
ExecuteSQL( "DELETE myTable WHERE @ROWID = %d", i );
// ExecuteSQL(...) is a C function that parses and executes the string.

// Jarmo

PS. I hope Im sending this mail to the right address, if not Im sorry DS.


pgsql-general by date:

Previous
From: Alfred Perlstein
Date:
Subject: Re: subselect in CHECK constraint?
Next
From: "Hiroshi Inoue"
Date:
Subject: RE: Updating cursors