Reputation: 1289
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
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
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
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