Subject Re: Can I delete a row that is the subject of a query that is deleting it??
Author mlq97
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@...> wrote:
>
> At 01:49 PM 16/02/2007, you wrote:
> >Can you be a bit more specific?
> >
> >
> >--- In firebird-support@yahoogroups.com, Hans <hhoogstraat@> wrote:
> > >
> > > Maybe the use of a CURSOR ?
>
> For Fb 1.5.x or lower:
>
> 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
> ! ^ !
>

Thanks.
Problem solved....as usual an error in my WHERE clause null handling!

Mitch