I wonder how can i make select statement from table which have a typed column ? Type of this column is defined as:
create or replace TYPE "MYCOL" as table of MYTYPE;
create or replace TYPE "MYTYPE" as OBJECT
( myid Number, myname Varchar2);
UPD1 Table is defined as
CREATE TABLE "T_TABLE"
( "ID" NUMBER NOT NULL ENABLE, "NAME" "MYCOL" )
If i select this column with select * from T_TABLE
i will get this not informative result:
1, MYSCHEMA.MYCOL([MYSCHEMA.MYTYPE],[MYSCHEMA.MYTYPE])
I want just to unwrap this types.
A VARRAY is similar to a nested table except you must specifiy an upper bound in the declaration. Like nested tables they can be stored in the database, but unlike nested tables individual elements cannot be deleted so they remain dense.
In order to create a nested table, the two source tables must contain a defined relationship so that the items in one table can be related to the other table. In SQL Server Data Tools, you can define this relationship in the data source view.
Understanding Nested TablesOracle stores the rows of a nested table in no particular order. But, when you retrieve the nested table into a PL/SQL variable, the rows are given consecutive subscripts starting at 1. That gives you array-like access to individual rows. PL/SQL nested tables are like one-dimensional arrays.
Try it like this:
select t."ID", tt.myid, tt.myname
from "T_TABLE" t, table(t."NAME") tt;
Here is a sqlfiddle demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With