Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> returning the contents of a table in plsql function

returning the contents of a table in plsql function

From: Craig Jennings <jennings_at_worldnet.att.net>
Date: Fri, 3 Jul 1998 13:08:22 -0700
Message-ID: <6njdmm$7gf@bgtnsc03.worldnet.att.net>


A newbie question:

I am trying to figure out a way to return the contents of a table (say scott.emp) in a plsql function. The reference books I have don't give examples of this. PL/SQL in 21 days even says that I can return a table as a datatype just as I can integer or varchar2. This seems completely false judging from the error information.

My next attempt was doing this using a cursor. It looked like this:

create or replace function return_emp

      return cursor is
declare

      cursor emp_table is select * from emp; begin

     open emp_table;
     return emp_table;

end;

Seemed logical enough, but this too failed. Obviously I am missing some information. If anyone can give me a code sample that works, I'd be greatly appreciative. All I am looking for is something that returns the contents of scott.emp.

Thanks in advance,

Received on Fri Jul 03 1998 - 15:08:22 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US