I am trying to write a function that would return the result of a select query. I have worked with very basic functions that would return a number and a varchar2(string). But now I want to return the result of a select, which would be like 10 rows and their corresponding columns.

How would I write the function and what would the return type be?

An example function that I have written is:

create or replace function func1 return varchar2 as begin return('hello from func1'); end func1;

I am still at a basic level, so can anybody help me out with returning the result of a select query? I believe cursors are to be used, as there would be more than one row.

Edit
Report