第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如果這些參數(shù)要作為表提示,則需要使用什么來(lái)實(shí)現(xiàn)?

如果這些參數(shù)要作為表提示,則需要使用什么來(lái)實(shí)現(xiàn)?

回首憶惘然 2022-10-20 17:15:23
create procedure bank_pro @ids varchar(10)asdeclare@bid varchar(10),@bname varchar(20),@baddr varchar(30),@bcity varchar(30),@sums money,@counts int,@SQL varchar(500)declare @curs cursor--select @sums = sum(a_balance) from account where a_bank_num = @ids;--select @counts=count(a_bank_num) from account where a_bank_num=@idsset @curs=cursor scroll dynamicforselect b.b_id,b.b_name,b.b_address,b.b_city,sum(a.a_balance),count(a.a_id)from bank b left join account a on b.b_id=a.a_bank_numwhere b.b_id = @idsgroup by b.b_id,b.b_name,b.b_address,b.b_cityopen @cursfetch next from @curs into @bid,@bname,@baddr,@bcity,@sums,@countswhile(@@fetch_status=0)beginprint '編號(hào) '+'名稱 '+'地址 '+'城市 '+'總金額 '+'賬戶數(shù) 'print @bid+@bname+@baddr+@bcity+convert(varchar(20),@sums)+' '+convert(varchar(20),@counts)fetch next from @curs into @bid,@bname,@baddr,@bcity,@sums,@countsif(@sums<1000000)beginset @SQL='insert into account() values(''1010'',''天天'',''60000'',''2012-11-23'','''+@ids+''')'print('該銀行總金額少于一百萬(wàn)')print(@SQL+'已執(zhí)行')exec(@SQL)endif(@counts=0)-- else if(@counts=0)beginprint('該銀行不存在用戶')set @SQL='delete from bank with b_id='''+@ids+''''print(@SQL+'已執(zhí)行')print('該銀行已被刪除')exec(@SQL)endend;
查看完整描述

1 回答

?
慕絲7291255

TA貢獻(xiàn)1859條經(jīng)驗(yàn) 獲得超6個(gè)贊

declare curs cursor
for
select b.b_id,b.b_name,b.b_address,b.b_city,sum(a.a_balance),count(a.a_id)
from bank b left join account a on b.b_id=a.a_bank_num
where b.b_id = @ids
group by b.b_id,b.b_name,b.b_address,b.b_city

open curs
fetch next from curs into @bid,@bname,@baddr,@bcity,@sums,@counts
while(@@fetch_status=0)
begin
print '編號(hào) '+'名稱 '+'地址 '+'城市 '+'總金額 '+'賬戶數(shù) '
print @bid+@bname+@baddr+@bcity+convert(varchar(20),@sums)+' '+convert(varchar(20),@counts)
fetch next from @curs into @bid,@bname,@baddr,@bcity,@sums,@counts
if(@sums<1000000)
begin
set @SQL='insert into account() values(''1010'',''天天'',''60000'',''2012-11-23'','''+@ids+''')'
print('該銀行總金額少于一百萬(wàn)')
print(@SQL+'已執(zhí)行')
exec(@SQL)
end
if(@counts=0)
-- else if(@counts=0)
begin
print('該銀行不存在用戶')
set @SQL='delete from bank with b_id='''+@ids+''''
print(@SQL+'已執(zhí)行')
print('該銀行已被刪除')
exec(@SQL)
end

CLOSE curs
DEALLOCATE curs

end


查看完整回答
反對(duì) 回復(fù) 2022-10-24
  • 1 回答
  • 0 關(guān)注
  • 144 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)