PL / SQL过程:如何返回一个select语句? [英] PL/SQL Procedure: How return a select statement?

查看:318
本文介绍了PL / SQL过程:如何返回一个select语句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个存储过程 Oracle数据库服务器上的,然后我的问题是,我不知道我怎么可以返回一个select语句。

I want to create a stored procedure on ORACLE database server and my problem is that, I don't know how can I return a select statement .

下面是逻辑的,应在过程中:

Here is the logic, which should within the procedure:

输入paramters:过滤器1(INT),过滤器2(串)

Input paramters: filter1 (int), filter2 (string)

with cte as
(
    select  val1, val2, stddev(val3) from tab1 where parameter1 = filter1 and paramter = filter1 group by val 1, val2
)
 SELECT cte.*,
    round(some calculation) as final_results FROM cte

后来我想用这个程序在MS asp.net应用程序,与MS ADO.net和MS实体框架4.2的帮助。

Afterwards I want to use this procedure in a MS asp.net application, with help of the MS ADO.net and MS Entity Framework 4.2.

感谢地段,为您的答复!

Lot of thanks, for your response!

推荐答案

在Oracle中,我们必须使用引用游标来达致这。 ODP净的最新版本支持参考光标为实体框架4.x的结合了解更多

In Oracle we have to use Ref Cursors to acheive this. The very latest version of ODP .Net supports Ref Cursor binding for Entity Framework 4.x. Find out more.

当然,如果你不使用Oracle 11gR2的你可能是出于运气,你会需要使用的其他建议之一(如流水线功能)。

Of course if you're not using Oracle 11gR2 you're probably out of luck, and you'll need to use one of the other suggestions (such as Pipelined functions).

这篇关于PL / SQL过程:如何返回一个select语句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆