Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Simple procedure/function to return select result

WarluckNov 23 2017 — edited Nov 24 2017

Bonjour,

   I have been searching the net and found MANY, many tips and tricks but nothing I have been able to reproduce.  I want, in Oracle, a procedure that will return the result of a simple select without having to set any serverouput, just like I could do in 2 lines in Sybase/MS SQL.

create table TESTTABLE (id numeric, var1 varchar2(10));

insert into table values (1, "A");

insert into table values (2, "B");

insert into table values (3, "C");

insert into table values (4, "D");

insert into table values (5, "E");

commit;

In Sybase/MSSQL

create procedure TESTPROC

as (select * from testtable)

Notes:

I know that Oracle procedure/function mechanism is more powerfull or versatile, still way much more complicated!

I know that Oracle catch up with simplicity in Oracle 12 but unfortunately, I'm still in 11g.

I want users to exec the procedure and get the result, that's it.  Don't want them to mess with serveroutput or cursor or anything,

exec the proc, get the result, be happy, give good feedback! 

I know it is a simple/stupid scenario, been asked a thousand times but still, never been answered to my liking.

How can I achieve the same in Oracle?

Thanks is advance for your time and mostly, your expertise!

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 22 2017
Added on Nov 23 2017
10 comments
7,175 views