Subject | Re: [firebird-support] Re: Can I delete a row that is the subject of a query that is deleting it?? |
---|---|
Author | Helen Borrie |
Post date | 2007-02-16T03:31:14Z |
At 01:49 PM 16/02/2007, you wrote:
BEGIN
FOR SELECT docline_id /* assuming this is the PK */
FROM docline
INTO :v_docline_id
/* where etc */
as cursor c DO
DELETE from docline WHERE current of c;
END
For Fb 2.0 or higher, more bells and whistles added - see the release notes.
Advantage of using a cursor: direct operation on the current row via
the rdb$db_key which is more efficient if it's a bulk op.
Don't forget to handle exceptions from locking conflicts.
./heLen
p.s. watch the requoting! threads turn into nightmares when you
persistently top-post and requote
! ^ !
>Can you be a bit more specific?For Fb 1.5.x or lower:
>
>
>--- In firebird-support@yahoogroups.com, Hans <hhoogstraat@...> wrote:
> >
> > Maybe the use of a CURSOR ?
BEGIN
FOR SELECT docline_id /* assuming this is the PK */
FROM docline
INTO :v_docline_id
/* where etc */
as cursor c DO
DELETE from docline WHERE current of c;
END
For Fb 2.0 or higher, more bells and whistles added - see the release notes.
Advantage of using a cursor: direct operation on the current row via
the rdb$db_key which is more efficient if it's a bulk op.
Don't forget to handle exceptions from locking conflicts.
./heLen
p.s. watch the requoting! threads turn into nightmares when you
persistently top-post and requote
! ^ !