Subject RE: [ib-support] Using Cursors
Author Alan McDonald
is it just the first records that total less than 50?
if so it's pretty simple
if not then what logic would you use? e.g. the highest amount less than 50
might be more difficult
-----Original Message-----
From: ristepejov [mailto:ristep@...]
Sent: Tuesday, 6 August 2002 21:34
Subject: [ib-support] Using Cursors

I can't make my stored procedure use cursors,

i followed the example given by Claudio Valderama in his paper about
SQL Server vs IB, but still can't make it work.

What i'm trying to do is:

I want to delete several records from a table using a stored proc,
where the sum of one of the columns in the deleted records does not
exceed some value;


ID | FK | description | amount
1 | 14 | bla bla | 20
2 | 12 | bla bla | 15
3 | 14 | bla bla | 25
4 | 14 | bla bla | 10
5 | 14 | bla bla | 20
6 | 12 | bla bla | 30
7 | 14 | bla bla | 40

So, i want to delete all the record with FK=14 but the sum(amount)
not to be larger then 50, so i delete only ID=1 and ID=3, in that
case the sum is 45 which is fine with the condition, and i also need
the stored proc to return the remaining amount as return value.

Can someone help, or at least advise ?

Yahoo! Groups Sponsor

To unsubscribe from this group, send an email to:

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

[Non-text portions of this message have been removed]