Oracle 存储过程中的简单选择

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

Simple Select inside an Oracle Stored Procedure

oraclestored-procedures

提问by OneSneakyMofo

how do you create a stored procedure with a simple select (SELECT * FROM TABLE) using Oracle? Also, any good tutorials on stored procedures would help tremendously.

如何使用 Oracle 使用简单的选择(SELECT * FROM TABLE)创建存储过程?此外,任何关于存储过程的好的教程都会有很大帮助。

Thanks.

谢谢。

回答by BQ.

It depends on what you're trying to return from the stored procedure (resultset vs. scalar value) and what version of Oracle you're on (newer versions make this easier).

这取决于您尝试从存储过程返回的内容(结果集与标量值)以及您使用的 Oracle 版本(新版本使这更容易)。

This question is probably a dupe of Get resultset from oracle stored procedure.

这个问题可能是从 oracle 存储过程获取结果集的骗局

回答by oralce passion

create or replace procedure spr_select_Emp(eno in number, employee out emp%RowType)
As

Begin
   Select empno,ename,mgrno,hiredate,sal,comm,deptno into employee from emp
   where empno=eno
End;

回答by Lucija

A procedure is created using the Oracle create or replace procedure syntax below:

使用以下 Oracle 创建或替换过程语法创建过程:

create or replace procedure () as (or is)

创建或替换过程 () as (或 is)

local variable declaration begin code section exceptions end;

局部变量声明开始代码段异常结束;

more info here: http://www.dba-oracle.com/t_create_or_replace_procedure.htm

更多信息:http: //www.dba-oracle.com/t_create_or_replace_procedure.htm