Re: Pro*C Delete help

From: Bob Stewart <bob_at_musem.earthlink.net>
Date: 21 Dec 1994 03:21:28 GMT
Message-ID: <3d86vo$pkh_at_moon.earthlink.net>


LMayhew (lmayhew_at_aol.com) wrote:
: >I use a cursor to read the rows of a table. After I read a row
: >I would like to delete it.
: >If that is not possible I would like to delete all the rows in
: >the table after I have read them all.
 

: If you add to your select.... the ROWID variable and the FOR UPDATE OF
: clause like ...
: select name, addr, ... ROWID
: from employee
: for update of name;
: Then you can delete the row by using the ROWID variable ...
: delete from EMPLOYEE where rowid = :srowid;

Normally you would use "WHERE CURRENT OF curserid" rather than a ROWID variable.

: Be sure and commit a few records as you go or you will run out of
: locks or enqueues... this is because the SELECT FOR UPDATE
: clause uses row locking...

I usually use a failsafe counter, say a thousand max, that ensures I COMMIT often enough to stay out of trouble.

--
If power corrupts, and absolute power corrupts absolutely,
government corruption WILL be reduced by reducing government power. q.e.d.

Bob Stewart (KB9ZW)
wk USA (310) 335-7152
Received on Wed Dec 21 1994 - 04:21:28 CET

Original text of this message