This may find little silly, but I would like to know whether this is possible.
I have a function which return sys_refcursor
CREATE OR REPLACE FUNCTION get_employee_details(p_emp_no IN EMP.EMPNO%TYPE)
RETURN SYS_REFCURSOR
AS
o_cursor SYS_REFCURSOR;
BEGIN
OPEN o_cursor FOR
SELECT EMPNO,
ENAME,
JOB,
MGR,
HIREDATE,
SAL,
COMM,
DEPTNO
FROM emp
WHERE EMPNO = p_emp_no;
RETURN o_cursor;
-- exception part
END;
/
and I could get the results using
select get_employee_details('7369') from dual;
Is it possible to get the result from the above function by specifying column name? E.g. If I would want to get ename or salary, how could I specify in the sql statement without using a plsql block? Something like
select get_employee_details('7369') <specific column> from dual;
select get_employee_details('7369') from dual
would return all the columns which is specified in the function select list of columns.