Home » SQL & PL/SQL » SQL & PL/SQL » returning result set in procedure
returning result set in procedure [message #2133] Sun, 23 June 2002 23:54 Go to next message
ga
Messages: 7
Registered: June 2002
Junior Member
i'm new in using oracle. i'm having a hard time creating stored procedure which returns a complete result set:

in MS SQL Server:

create procedure get_list
as
select * from emp

the case here is that i want to retrieve all records in table emp. this is how i do it in MS SQL Server.
i try doing the same in Oracle:

create procedure get_list
is
begin
select * from emp;
end;

in doing this i get an error telling me that INTO is expected. can you help me on this? i'll appreciate
any help. thanks in advance.
Re: returning result set in procedure [message #2136 is a reply to message #2133] Mon, 24 June 2002 02:15 Go to previous messageGo to next message
seng
Messages: 191
Registered: February 2002
Senior Member
you need to construct SELECT statement as below

SELECT column INTO variable
FROM table
WHERE condition.

Note: This statement must not return more then a record if no then error message. For more then a record use cursor. for more information please refer to SQL,PL/SQL document. Hope this is helping
Re: returning result set in procedure [message #2146 is a reply to message #2133] Mon, 24 June 2002 10:09 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
http://osi.oracle.com/~tkyte/ResultSets/index.html
Previous Topic: how to get the key of a relation?
Next Topic: urgent..How to get the creation script for the objects java sources,libraries and type bodies..
Goto Forum:
  


Current Time: Wed Apr 24 00:06:10 CDT 2024