Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

CAST: Name of column in a TABLE CAST from a simple table type?

521495Feb 7 2007 — edited Feb 7 2007
How do I name an anonymous column returned from a table type?

Here is the type:

CREATE OR REPLACE TYPE t_mytab AS TABLE OF VARCHAR2 (10);

Later on, we want to use some of these tables inside a SQL SELECT, so we would have something like this for a variable "tab1" of this type:

CURSOR c1
IS
SELECT t1.*
FROM TABLE (CAST (tab1 AS t_mytab)) t1;

But what is the name of the "column" being returned by this TABLE/CAST?

I've tried doing:

CURSOR c1
IS
SELECT t1.* AS mycol
FROM TABLE (CAST (tab1 AS t_mytab)) t1;

But of course you can't do this when you're selecting *.

I'm sure the solution is blindingly obvious. But I can't see it, so any tips would be welcome.

Thanks.

Chris
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 7 2007
Added on Feb 7 2007
3 comments
537 views