- 论坛徽章:
- 0
|
--drop table dt1;
create table dt1
(
d1 date,
bal decimal(16,2)
);
create procedure testdt1() returning int,decimal(16,2);
define vd1 like dt1.d1;
define vd2 like dt1.d1;
define vbal1 like dt1.bal;
define vbal2 like dt1.bal;
define first integer;
let first =1;
foreach select d1,bal into vd1,vbal1 from dt1
if first = 1 then
let first = 0;
let vd2 = vd1;
let vbal2 = vbal1;
else
return vd1-vd2,vbal1-vbal2 with resume;
let vd2 = vd1 ;
let vbal2 = vbal1 ;
end if
end foreach
end procedure;
d1 bal
(expression) (expression)
2005-03-21 7995.91
2005-03-21 7484.41 0 -511.50
2005-03-21 3715.03 0 -3769.38
2005-03-21 3515.03 0 -200.00
2005-03-21 3485.33 0 -29.70
2005-03-21 83485.33 0 80000.00
2005-03-21 13485.33 0 -70000.00
2005-04-01 8485.33 11 -5000.00
2005-04-06 3485.33 5 -5000.00
2005-05-20 1485.33 44 -2000.00
2005-05-26 8666.33 6 7181.00
2005-05-26 25666.33 0 17000.00
2005-06-04 5666.33 9 -20000.00
2005-06-18 15666.33 14 10000.00
2005-06-21 15680.54 3 14.21
2005-06-21 8556.29 0 -7124.25
2005-06-21 56.29 0 -8500.00
2005-06-21 32056.29 0 32000.00
2005-06-21 57056.29 0 25000.00
2005-06-21 357056.29 0 300000.00
2005-06-21 7056.29 0 -350000.00
2005-06-22 13556.29 1 6500.00
2005-06-24 9556.29 2 -4000.00
2005-06-28 94556.29 4 85000.00
2005-06-28 34556.29 0 -60000.00
2005-06-30 22791.79 2 -11764.50
2005-06-30 12972.29 0 -9819.50
2005-07-08 972.29 8 -12000.00
2005-07-13 13972.29 5 13000.00
2005-07-13 813972.29 0 800000.00
2005-07-13 903972.29 0 90000.00
2005-07-13 904972.29 0 1000.00
2005-07-13 4972.29 0 -900000.00
2005-07-13 591.54 0 -4380.75
2005-07-13 571.99 0 -19.55
2005-07-19 14571.99 6 14000.00
2005-07-22 282884.99 3 268313.00
2005-07-22 192884.99 0 -90000.00
2005-07-23 187884.99 1 -5000.00
2005-07-23 97884.99 0 -90000.00
2005-07-25 9571.99 2 -88313.00
2005-07-31 27571.99 6 18000.00
2005-08-18 20571.99 18 -7000.00
2005-08-21 17571.99 3 -3000.00
2005-09-01 10571.99 11 -7000.00
2005-09-02 5571.99 1 -5000.00
2005-09-09 1571.99 7 -4000.00
2005-09-17 31571.99 8 30000.00
2005-09-21 31605.65 4 33.66
2005-09-26 57895.65 5 26290.00
2005-09-26 51478.65 0 -6417.00
2005-09-26 38458.65 0 -13020.00
2005-09-26 26694.15 0 -11764.50
2005-09-27 6694.15 1 -20000.00
2005-10-01 694.15 4 -6000.00
2005-10-28 8604.15 27 7910.00
2005-10-31 2604.15 3 -6000.00
2005-11-11 152484.15 11 149880.00
2005-11-12 92484.15 1 -60000.00
2005-11-15 88484.15 3 -4000.00
2005-12-01 83484.15 16 -5000.00
2005-12-02 383484.15 1 300000.00
2005-12-02 303484.15 0 -80000.00
2005-12-05 103484.15 3 -200000.00
2005-12-05 93484.15 0 -10000.00
2005-12-08 70484.15 3 -23000.00
2005-12-12 70464.15 4 -20.00
2005-12-12 57464.15 0 -13000.00
2005-12-13 47464.15 1 -10000.00
2005-12-21 47546.63 8 82.48
2005-12-23 30620.63 2 -16926.00
2005-12-23 24273.38 0 -6347.25
2005-12-23 12636.75 0 -11636.63
2005-12-27 234636.75 4 222000.00
2005-12-28 32636.75 1 -202000.00
2005-12-30 82636.75 2 50000.00
2006-01-05 52636.75 6 -30000.00
2006-01-06 140636.75 1 88000.00
2006-01-06 120636.75 0 -20000.00
2006-01-07 75636.75 1 -45000.00
2006-01-08 65636.75 1 -10000.00
2006-01-09 39636.75 1 -26000.00
2006-01-11 31636.75 2 -8000.00
2006-01-12 16636.75 1 -15000.00
2006-01-13 1636.75 1 -15000.00
2006-01-19 81636.75 6 80000.00
2006-01-20 71636.75 1 -10000.00
2006-01-22 58636.75 2 -13000.00
2006-01-23 18636.75 1 -40000.00
2006-01-23 226636.75 0 208000.00
2006-01-24 178636.75 1 -48000.00
2006-01-24 163636.75 0 -15000.00
2006-01-25 139636.75 1 -24000.00
2006-01-25 119636.75 0 -20000.00
2006-01-27 89636.75 2 -30000.00
2006-01-27 69636.75 0 -20000.00
2005-03-17 71471.61 -316 1834.86
2005-03-17 621471.61 0 550000.00
2005-03-17 21471.61 0 -600000.00
2005-03-17 18295.17 0 -3176.44
2005-03-17 18287.43 0 -7.74
2005-03-17 18285.61 0 -1.82
2005-03-18 3285.61 1 -15000.00
2005-03-21 3287.47 3 1.86
2005-03-21 87.47 0 -3200.00
2005-03-21 25087.47 0 25000.00
2005-03-21 25687.47 0 600.00
[ 本帖最后由 wenlq 于 2006-2-10 09:03 编辑 ] |
|