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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Best practice question: Updating Aggregates

Re: Best practice question: Updating Aggregates

From: <casey.kirkpatrick_at_gmail.com>
Date: 7 Oct 2005 14:32:16 -0700
Message-ID: <1128720736.401666.134070@o13g2000cwo.googlegroups.com>


Daniel,

We seem to be talking past each other. Let me be brief: I have an application that produces output based on aggregate data, but must update the source rows it pulls from.

*****From the perspective of writing maintainable, clear, bug-free code******, is there any preference between: 1) Fetching the data in a single aggregate cursor, then updating it in a separate statement or
2) Fetching the data in a non-aggregate FOR UPDATE cursor, updating one record at a time, and aggregating the data in the PL/SQL layer.

The one reason I present the issue is because I'm conflicted: my intuition to avoid coding logic in PL/SQL that which can be put in SQL points me towards #1; but my intuition to enforce data integrity points me towards# 2; my question is: does anyone know of a middle-ground solution to this, or a definitive reason to choose one over the other?

And Daniel, a side question: in evaluating code, do you look at anything besides the code getting correct results and performing well? Would you teach a beginner about AUTOTRACE prior to teaching about referential integrity? I've had co-workers fix Catesian products by adding a DISTINCT clause and some parallelism... because they think only two things count in their code: corrctness and speed. I've always wondered where such a philosphy could have been seeded. Received on Fri Oct 07 2005 - 16:32:16 CDT

Original text of this message

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