create procedure sp_get_product_allprice
@fld_uid int
as


declare @sumprice float

set @sumprice=0

declare cur_cart cursor
for
select fld_price,fld_count
from tbl_product where fld_uid = @fld_uid
for read only


open cur_cart


declare @product_price float
declare @product_count int


fetch next from cur_cart into @product_price,@product_count
while @@fetch_status = 0 
begin
  set @sumprice = @sumprice + (@product_price * @product_count)
   fetch next from cur_cart into @product_price,@product_count
end

close cur_cart  
DEALLOCATE cur_cart

 

posted on 2009-04-15 23:23  阿春  阅读(224)  评论(0)    收藏  举报