CREATE OR REPLACE FUNCTION TEST_SUBSELECT (i_firstname in varchar) RETURN types.cursorType IS o_cursor types.cursorType; BEGIN OPEN o_cursor FOR SELECT * FROM party WHERE firstname LIKE '%' || i_firstname || '%'; return o_cursor; END; 12 / Function created. SQL> select * from TABLE(test_subselect('foo')); select * from TABLE(test_subselect('foo')) * ERROR at line 1: ORA-22905: cannot access rows from a non-nested table item