【发布时间】:2018-08-14 05:37:21
【问题描述】:
在甲骨文中,
我们可以像下面这样声明一个输入-输出参数(不仅仅是输入或输出):
Create Or Replace Procedure USERTEST.SimpleInOutProcedure(
p_InputInt Int,
p_OutputInt out Int,
p_InputOutputInt in out Int
) AS
BEGIN
p_OutputInt := p_InputInt + 1;
p_InputOutputInt := p_InputOutputInt + p_InputOutputInt;
END;
但是,当我尝试在 SQL Server 中声明时,脚本无法编译:
create procedure SimpleInOutProcedure
@p_InputInt int, @p_OutputInt int input output
As
Begin
Select * from TestTableCommonA;
End
“输入”一词不是预期的,因此在 SQL Server Management Studio 中不是蓝色的:
我的脚本有什么问题,如何在 SQL Server 存储过程/函数中声明输入输出参数?
我想这样做是因为我需要为 SQL Server DB 创建“等效”读取器,该读取器以前是为 Oracle DB 创建的,并且具有输入/输出参数的读取器。
【问题讨论】:
标签: sql sql-server oracle function stored-procedures