CAST: Name of column in a TABLE CAST from a simple table type?
521495Feb 7 2007 — edited Feb 7 2007How 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