OneSneakyMofo
OneSneakyMofo

Reputation: 1289

Simple Select inside an Oracle Stored Procedure

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.

Thanks.

Upvotes: 6

Views: 49011

Answers (3)

oralce passion
oralce passion

Reputation: 41

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;

Upvotes: 4

Lucija
Lucija

Reputation: 9

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

create or replace procedure () as (or is)

local variable declaration begin code section exceptions end;

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

Upvotes: 0

BQ.
BQ.

Reputation: 9413

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).

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

Upvotes: 9

Related Questions