SSRS 在 Oracle 中执行存储过程

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4025588/
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 21:45:51  来源:igfitidea点击:

SSRS executing a Stored Procedure in Oracle

oraclestored-proceduresreporting-services

提问by MikeTWebb

I have a Report in SSRS VS2008 that needs to run a Stord Procedure from Oracle. In the past I have run functions from Oracle that return tables in order to display the data. As well as straight forward SELECT statements

我在 SSRS VS2008 中有一份报告,需要从 Oracle 运行存储过程。过去,我运行过 Oracle 中的函数,这些函数返回表以显示数据。以及直接的 SELECT 语句

For example:

例如:

select * from table(MyFunction(:parm1, :parm2))
select * from MyTable

I have not run a Stored Procedure from Oracle in SSRS and I am wondering....

我没有在 SSRS 中从 Oracle 运行存储过程,我想知道....

How do I define the Query in the DataSet to return the results?

如何在 DataSet 中定义 Query 以返回结果?

回答by

Create a stored procedure with an output parameter of type SYS_REFCURSOR, and place the results of the query in the output cursor within the procedure - like so:

使用 SYS_REFCURSOR 类型的输出参数创建一个存储过程,并将查询结果放在过程中的输出游标中 - 如下所示:

CREATE OR REPLACE PROCEDURE pr_myproc(L_CURSOR out SYS_REFCURSOR) 
is
   BEGIN
     OPEN L_CURSOR FOR
       SELECT * FROM mytable;
   END;

Then create the dataset in your report - on the Query tab, set the Command type to StoredProcedure, and the Query string to the name of the procedure, eg. pr_myproc. If you check the fields tab, these should match the expected structure of the cursor, ie. the query output.

然后在您的报告中创建数据集 - 在查询选项卡上,将命令类型设置为 StoredProcedure,将查询字符串设置为过程名称,例如。pr_myproc。如果您检查字段选项卡,它们应该与光标的预期结构相匹配,即。查询输出。