Re: Deleting Multiple Rows

From: Guadala Harry (GMan_at_NoSpam.com)
Date: 08/16/04


Date: Mon, 16 Aug 2004 16:14:12 -0700

Yes - AND - being *able* to put it in the WHERE clause is very different
than saying it *should* go there. My app has some rather highly performing
"in-memory" structures (a tree comprised of of hash tables and
ListDictionary collections) in which user preferences (i.e., inserts,
updates, and deletes) are cached. IF/When the user decides to save changes,
I'd like to ship off a list of rows to delete to the DB. In my case I'd
conclude that it's not realistic (although possible) to do it all in the DB
(we're very interested in minimizing number of db connections, db hits,
etc). A couple of years ago, the recommended strategy (per this very group)
was to create a loop in my application - wrap the loop in an ADO
transaction - and execute a stored procedure - once per loop - that would do
any inserts/updates/deletes. I never really liked that solution - but it was
the lesser evil relative to the old nasty ADO .UpdateBatch() method... Just
revisiting the issue now that I'm on a new system and now that our
technologies have evolved somewhat since ADO.

Thanks!

"Joe Celko" <jcelko212@earthlink.net> wrote in message
news:OICl0y9gEHA.2812@tk2msftngp13.phx.gbl...
> >> The logic that determines which rows to delete has to stay in the
> application (can't realistically be moved to the db). <<
>
> Why? The only reason I can come up with is that a human being or
> external agent is making unpredictable numbers as they go along. If
> there was an algorithm, then you ought to be able to put it in the WHERE
> clause of a DELETE FROM statement.
>
> >> Too bad there's not an easy way to pass a varchar variable
> (containing a delimited list of the ints) to the WHERE clause of the
> DELETE statement... <<
>
> There are a bunch of such kludges posted here. They are all dangerous
> and slow thanks to dynamic SQL.
>
> --CELKO--
> ===========================
> Please post DDL, so that people do not have to guess what the keys,
> constraints, Declarative Referential Integrity, datatypes, etc. in your
> schema are.
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Relevant Pages

  • Re: LOOP blows!
    ... The order of initialization follows the ... There are two `initializations' in execution of LOOP, ... before staring the first iteration. ... |> The first for clause will never terminate. ...
    (comp.lang.lisp)
  • Re: LOOP blows!
    ...     clauses appear in the source. ... This clause is not combined with the ... Right, and ``People'' includes the ones implementing LOOP, apparently, ... You must use your hidden list iteration variable to set up the ...
    (comp.lang.lisp)
  • Re: The mystery of the missing (compound) variables.
    ... separated text string line which can be PARSEd. ... limit of 50 passes through the loop. ... to the second last END clause. ... other than READY the THEN LEAVE clause passes control to the second ...
    (comp.lang.rexx)
  • RE: Oracle cursor help
    ... rids dbms_utility.uncl_array; ... where <your where clause> ... Subject: Re: Oracle cursor help ... exit the loop: */ ...
    (perl.dbi.users)
  • Re: The LOOP macro (was Re: Be afraid of XML)
    ... | The FINALLY clause is definitely "textually within the loop", ... Whether the FINALLY clause is within the scope of the iteration variables. ... before the *next* iteration if the termination condition is not met, ...
    (comp.lang.lisp)