converting a cursor into a table? [message #382923] |
Mon, 26 January 2009 06:54  |
gamba
Messages: 10 Registered: June 2008
|
Junior Member |
|
|
hi, I have a function that returns a sys_refcursor - let's call it GetCursorFunction();
I'd like to do something like:
select * from GetCursorFunction;
is that possible?
thanks.
|
|
|
|
|
Re: converting a cursor into a table? [message #382932 is a reply to message #382926] |
Mon, 26 January 2009 08:05   |
gamba
Messages: 10 Registered: June 2008
|
Junior Member |
|
|
thanks for the reply.
the problem is, it isn't really like a table. sqlplus does show (while others like TOAD do not) but I can't do table operations with it.
for example:
create table MyTable
(
id number,
value varchar2(100)
);
create function MyFunction
return sys_refcursor
is
cur sys_refcursor;
begin
open cur for
select 1, 'one' from dual;
return cur;
end;
insert into MyTable
select MyFunction from dual;
that does not work. it treats the cursor returned as a single value...
|
|
|
|
Re: converting a cursor into a table? [message #382941 is a reply to message #382935] |
Mon, 26 January 2009 08:44   |
gamba
Messages: 10 Registered: June 2008
|
Junior Member |
|
|
I see.
the problem is, a pipelined function requires I define a type for each different cursor. is that right?
for example:
for a table (id number, value varchar2) I'd need a different function and type than table(name varchar2, birthdate date)
yes?
|
|
|
|