如何在存储过程A里调用存储过程B
存储过程B有3个输入参数一个输出参数,这个存储过程在每一个DB里都有
ALTER PROCEDURE [dbo].[GSP_GR_GetUserPlayedRounds]
@userID INT,
@begin DATETIME,
@end DATETIME,
@Sum INT OUTPUT
AS
BEGIN
......
END
RETURN 0
然后建立一个存储过程A,A需要在每一个DB里执行B,但我发现A往B传递输入输出参数总是有问题,执行报错:
while (@@fetch_status = 0)
begin
SET @Sql= @DataBaseName+N'Link.'+@DataBaseName +N'.dbo.GSP_GR_GetUserPlayedRounds'
exec sp_executesql @Sql, N' @userID int, @begin datetime, @end datetime, @Sum int output', @userId, @begin, @end, @Sum output
SET @RoundsNum = @RoundsNum + @Sum
fetch next from pcurr into @DataBaseName
end
close pcurr
deallocate pcurr
循环里的@DataBaseName是没有问题的,就是exec sp_executesql @Sql, N' @userID int, @begin datetime, @end datetime, @Sum int output', @userId, @begin, @end, @Sum output
这里好像不对,但是也不知道哪里错了,其中 @userId, @begin, @end是A的输入参数,@Sum是A中声明的变量
ALTER PROCEDURE [dbo].[GSP_GR_GetUserPlayedRounds]
@userID INT,
@begin DATETIME,
@end DATETIME,
@Sum INT OUTPUT
AS
BEGIN
......
END
RETURN 0
然后建立一个存储过程A,A需要在每一个DB里执行B,但我发现A往B传递输入输出参数总是有问题,执行报错:
while (@@fetch_status = 0)
begin
SET @Sql= @DataBaseName+N'Link.'+@DataBaseName +N'.dbo.GSP_GR_GetUserPlayedRounds'
exec sp_executesql @Sql, N' @userID int, @begin datetime, @end datetime, @Sum int output', @userId, @begin, @end, @Sum output
SET @RoundsNum = @RoundsNum + @Sum
fetch next from pcurr into @DataBaseName
end
close pcurr
deallocate pcurr
循环里的@DataBaseName是没有问题的,就是exec sp_executesql @Sql, N' @userID int, @begin datetime, @end datetime, @Sum int output', @userId, @begin, @end, @Sum output
这里好像不对,但是也不知道哪里错了,其中 @userId, @begin, @end是A的输入参数,@Sum是A中声明的变量
...全文
相关推荐
Oracle存储过程及调用
Oracle存储过程语法 Oracle的存储过程语法如下: create procedure 存储过程名称(随便取) is 在这里可以定义常量、变量、游标、复杂数据类型这里可以定义变量、常量 begin 执行部分 end; (2)带参数的存储过程语法: create procedure 存储过程名称(随便取) (变量1 数据类型,变量2 数据类型,...,变量n 数据类型) is 在这里可以定义常量、变量、游标、复杂数据类型这里可以定义变量、常量 begin 执行部分 end; (3)带输入、输出参数的存储过程语法: create procedure
C#中调用ORACLE的PACKAGE里方法和存储过程的应用
1、首先在ORACLE里建立如下PACKAGE PACKAGE分SPEC和body两部分 2、C#部分代码
SQLServer存储过程调用WebService
SQL Server数据库中直接调用Web Service,不需要通过前台调用
pb调用存储过程
Pb 调用 DECLARE lpro_test PROCEDURE FOR proc_pslx; EXECUTE lpro_test ; 存储过程 CREATE PROCEDURE proc_pslx AS insert into demo(name) values('55566') GO
mybatis调用存储过程的实例代码
主要介绍了mybatis调用存储过程的实例,非常不错,具有参考借鉴价值,需要的朋友可以参考下


