rename column_value


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         

Put your code in <code> and </code> tags

2 Responses to “rename column_value”

  1. Sokrates Says:

    what’s wrong with

    SQL> select t.column_value as bar from table(f) t;

    BAR
    ————
    foo

    ?

  2. Laurent Schneider Says:

    nothing wrong actually, I just wanted to show how to get an user-defined column name 8-)

Leave a Reply

Use <code> and </code> to post code