日期:2014-05-18  浏览次数:21039 次

明明声明了参数,它老是说未提供。。
if exists(select * from sysobjects where name='proc_trans3')
drop procedure proc_trans3
go
create procedure proc_trans3
@cID1 varchar(20) output,--输出卡号
@cID2 varchar(20) output, 
@bala1 money output,--输出余额
@bala2 money output ,
@date varchar(20) --输出日期
 
as
  set nocount on

  declare @id1 int,@id2 int

  insert into userInfo(customerName,PID,telephone,address)
  values('王五','334456889012678','2222-63598978','河南新乡') 
  select @id1=customerName from userInfo where customerName='王五'

  insert into cardInfo(cardID,savingType,openMoney,balance,customerID)
  values('1010 3576 '+Convert(varchar(4),right(rand(datepart(ms,getdate())*1000),4))+' '+Convert(varchar(4),right(rand(DATEPART(mm,GETDATE())*1000),4)),
  '活期',1000,1000,@id1) 
  select @cID1=cardID,@date=openDate,@bala1=balance from cardInfo where customerID=@id1
  
 insert into userInfo(customerName,PID,telephone,address)
 values('赵二','213445678912342222','0760-44446666',null)
 select @id2=customerName from userInfo where customerName='李四'
 insert into cardInfo(cardID,savingType,openMoney,balance,customerID)
 values('1010 3576 '+Convert(varchar(4),right(rand(datepart(ms,getdate())*1000),4))+' '+Convert(varchar(4),right(rand(DATEPART(mm,GETDATE())*1000),4)),
  '定期',1,1,@id2)
  select @cID2=cardID,@date =openDate,@bala2=balance from cardInfo where customerID=@id2
go

declare @cID1 varchar(20),@cID2 varchar(20)  
declare @bala1 money,@bala2 money

exec proc_trans3 @cID1 output,@bala1 output 
select @bala1
exec proc_trans3 @cID2 output,@bala2 output 
select @bala2
go
select * from userInfo
select * from cardInfo
 
 

消息 201,级别 16,状态 4,过程 proc_trans3,第 0 行
过程或函数 'proc_trans3' 需要参数 '@bala1',但未提供该参数。

---------------------
NULL

消息 201,级别 16,状态 4,过程 proc_trans3,第 0 行
过程或函数 'proc_trans3' 需要参数 '@bala1',但未提供该参数。

---------------------
NULL

customerID customerName PID telephone address
----------- ------------ ------------------ --------------- ----------------------------------------
5 张三 123456789012345 010-67898978 北京海淀
6 李四 321245678912345678 0478-44443333 NULL
7 speed 123456789123456789 0835-78945612 NULL

cardID curType savingType openDate openMoney balance pass IsReportLoss customerID
-------------------- ---------- -------------------- ----------------------- --------------------- --------------------- -------------------------------- ------------ -----------
1010 3576 1212 1134 RMB 定期 2008-11-08 10:40:49.000 1.00 5701.00 123123 1 6
1010 3576 1234 5678 RMB 活期 2008-11-08 10:40:48.983 1000.00 100.00 123456 0 5
1010 3576 7664 8536 RMB 定期 2008-11-08 15:33:06.670 3.00 3.00 888888 0 7
1010 3576 8312 8312 RMB 定期 2008-11-08 15:20:52.077 3.00 3.00 888888 0 7
1010 3576 9147 3424 RMB 定期 2008-11-08 15:32:44.903 3.00 3.00 888888 0 7



------解决方案--------------------