从 SQL Server 链接服务器调用 Oracle 函数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1270113/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 18:47:07 来源:igfitidea点击:
Calling an Oracle function from SQL Server Linked Server
提问by Hemanshu Bhojak
I have setup a linked server pointing to an Oracle DB. I want to call a function ABC in a package XYZ passing parameter K. What will be the syntax to do this?
我已经设置了一个指向 Oracle DB 的链接服务器。我想在传递参数 K 的包 XYZ 中调用函数 ABC。这样做的语法是什么?
回答by Hemanshu Bhojak
I used the following syntax and it worked for me.
我使用了以下语法,它对我有用。
EXECUTE (Query, Parameters) AT LinkedServerName
Example:
例子:
EXECUTE ( 'BEGIN ? := Package.MyFunction(?,?); END;', @ReturnValue, @InputPara, @OutputPara OUTPUT ) AT LinkedServerName
Important Points:
要点:
- Don't forget the BEGIN and END syntax when calling functions
- Don't forget the semicolon at the end "END**;**"
- For using the above syntax you need to enable RPC for the linked server
- Oracle will not consider the call as a function call unless you accept the output in a variable
- 调用函数时不要忘记 BEGIN 和 END 语法
- 不要忘记末尾的分号“END**;**”
- 要使用上述语法,您需要为链接服务器启用 RPC
- 除非您接受变量中的输出,否则 Oracle 不会将该调用视为函数调用