[英]Calling an Oracle stored procedure that uses an output parameter from Microsoft SQL Server
I am trying to execute a stored procedure on an Oracle 10g server, which returns its results in an output parameter, from a SQL Server 2008 query. 我正在尝试在Oracle 10g服务器上执行存储过程,该存储过程从SQL Server 2008查询以输出参数形式返回其结果。
The Oracle stored procedure declaration looks like this: Oracle存储过程声明如下所示:
PROCEDURE MY_PROC(
ID IN NUMBER,
RESULT OUT CURSOR_TYPE);
How would I call this stored procedure from MS SQL Server 2008, using either OpenQuery or any method of querying Oracle, and be able to see the result set stored in 'RESULT'? 我将如何使用OpenQuery或任何查询Oracle的方法从MS SQL Server 2008中调用此存储过程,并能够看到存储在“ RESULT”中的结果集?
I did that from SQL SERVER to SQL SERVER and it's work well. 我从SQL SERVER到SQL SERVER都做到了,而且效果很好。 Maybe in Oracle you will need some chages. 也许在Oracle中,您将需要一些挑战。
here is my code in sql server 这是我在SQL Server中的代码
--drop proc proc_test_test create proc proc_test_test ( --drop proc proc_test_test创建proc proc_test_test(
@a int, @b int output @a int,@ b int输出
) as begin )开始
set @b = @a*6+4 设置@b = @ a * 6 + 4
end 结束
select * 选择 *
from openrowset('type','server name';'user';'pass', 来自openrowset('type','server name';'user';'pass',
'declare @answer int ; '声明@answer int;
exec db.dbo.proc_test_test @a = 1, @b = @answer output; exec db.dbo.proc_test_test @a = 1,@ b = @answer输出;
select @answer as a' ) 选择@answer作为a')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.