Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: updating current row of cursor resultset in OCI

Re: updating current row of cursor resultset in OCI

From: Harald Maier <maierh_at_myself.com>
Date: Mon, 08 Sep 2003 18:24:46 +0200
Message-ID: <m3ptibw8mp.fsf@ate.maierh>


joeyee1_at_msn.com (Joe) writes:

> I'm using Oracle9i and converting some existing applications from
> Sybase, which allows for update of current row in the result set with
> its ct_cursor function call. I've looked through the Oracle
> documentation, the news groups in Google and asktom.oracle.com and
> haven't found an example in OCI of how to do something like this:
>
> Some sample C code that uses OCI to create a cursors using the "OPEN
> C1 FOR SELECT ... FOR UPDATE", and later uses the cursor (C1) to
> update the row via the "UPDATE ... SET .... WHERE CURRENT OF C1"
> statement.
>
> I saw that this question was posed before on many occasions, and there
> were basically 2 types of response (1) No response (2) Use rowid as
> part of the "SELECT ... FOR UPDATE". This second option, although
> seems to work, also appears to be a hack. It looks like a hack because
> (a) I saw a bunch of postings and in asktom.oracle.com that the rowid
> may change depending on the type of data changes (b) updating current
> row of cursor result set is supposed to be in the SQL standard and I
> can do it in PL/SQL, why do I need to play around with rowid, which is
> an internal feature of the Oracle database.

From the concept manual (a96524):

"Because rowids are constant for the lifetime of a row piece, it is useful to reference rowids in SQL statements such as SELECT, UPDATE, and DELETE."

So the second method is safe.

Harald Received on Mon Sep 08 2003 - 11:24:46 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US