This content has been marked as final. Show 4 replies
Since you are trying to fetch into an object, your SELECT must select object:
CREATE OR REPLACE FUNCTION emp_fn RETURN NUMBER IS l_emp t_emp; CURSOR c1 IS SELECT t_emp( empno, ename, job, mgr, hiredate, sal, comm, deptno ) FROM emp; BEGIN OPEN c1; LOOP FETCH c1 INTO l_emp; EXIT WHEN c1%NOTFOUND; END LOOP; RETURN 0; END; /
Thank you so much for the quick reply. It makes sense now.
BTW: What do you do to format the code nicely like you did?
Christoph wrote:This site normally doesn't display multiple spaces in a row.
... BTW: What do you do to format the code nicely like you did?
Whenever you post formatted text (such as query results) on this site, type these 6 characters:
(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
SELECT 'Thanks a lot!' FROM dual;