oracle - Tail call for pipelined functions -


i have pipelined function:

create type my_tab_type table of ...  create function my_func (x in number) return my_tab_type pipelined begin   loop     ...     pipe row (...);   end loop;   return; end; 

now want create pipelined function my_func_zero same my_func fixed value of parameter: my_func_zero must equivalent my_func(0).

can implement my_func_zero without senseless , boring loop processing every row returned select * table(my_func(0))?

p.s. that thread bit similar, not contain answer question.

it's possible, if don't declare second function pipelined because functions of type return results on row-by-row basis.

if omit requirement can reach target bulk collect if need typed cursor:

create function my_zero_func return my_tab_type   res_table my_tab_type; begin    select my_type(field1, field2)   bulk collect res_table   table(my_func(0));    return res_table;  end; 

alternatively can use untyped cursor:

create function my_ref_zero_func return sys_refcursor   vres sys_refcursor; begin    open vres select * table(my_func(0));    return vres;  end; 

sqlfiddle

in client application my_ref_zero_func results may used without changes, in sqlfiddle converted xml representation because there no way demonstrate ref cursor tool.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -