SQL> create or replace type t is
2 table of varchar2(12);
3 /
Type created.
SQL> create or replace function f return t is
2 begin return t('foo'); end;
3 /
Function created.
SQL> select * from table(f);
COLUMN_VALUE
------------
foo
What is this column_value field? It is a pseudo-column. But you may want to have an user-defined column name.
SQL> create or replace type o is
2 object(BAR varchar2(12));
3 /
Type created.
SQL> create or replace type t is
2 table of o;
3 /
Type created.
SQL> create or replace function f return t is
2 begin return t(o('foo')); end;
3 /
Function created.
SQL> select * from table(f);
BAR
------------
foo
what’s wrong with
SQL> select t.column_value as bar from table(f) t;
BAR
————
foo
?
nothing wrong actually, I just wanted to show how to get an user-defined column name 😎