1 million recs on DB - want to execute a calculation on only 100 recs

Ruslan Zasukhin sunshine at public.kherson.ua
Wed Oct 3 01:37:13 CDT 2007


On 3/10/07 4:17 AM, "Barry G. Sumpter" <BarrySum at BigPond.Net.AU> wrote:

Hi Barry,

> Hi all,
> 
> Just trying to sort this out.
> 
> 
> I have a very simple calculation.
> 
> Step1
> Round up the item price to the next dollar
> Step 2
> Add 10% to the result in step 1
> Step 3
> Round to the nearest point
> Step 4
> Use the result in step 3 to update the xxx db field
 
> As I don't want to:
>   execute a SQL to retrieve the 100 recs.
>   Loop thru each rec and execute a singe update SQL for each rec
> 
> 
> I want the DB to do all the work thru a single SQL command.
> 
> What's the best method for this calculation?
> 
> i.e. a stored calculation procedure ?
>     as we use this calculation in many places
>       where we could use a single SQL Update Command
>            that selects the 100 recs
>               and calls the stored calculation procedure

Yes this is a good way
 
> or perhaps a single SQL update command
>    that selects the 100 recs
>      that somehow contain this calculation embedded in the SQL
>             (not as a stored procedure)

If you cannot express your idea in single UPDATE command, then even better.
But if not then Procedure can be solution. Procedures can do things MORE
complex then single UPDATE

-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list