0
votes

This is a small exercise using varray, but I couldn't retrieve the varray table.

create type price_array as VARRAY(10) OF NUMBER(6,2)
/

create table price_table(
    pno int,
    prices price_array)
/

insert into price_table values (1,price_array(2.00,3.00,4.00))
/
insert into price_table values (2,price_array(2.00,3.00,4.00))
/
insert into price_table values (3,price_array(2.00,3.00,4.00))
/

select * from PRICE_TABLE
/

SELECT pno, s.COLUMN_VALUE prices
from pricelist p,TABLE(p.prices) s
/

Output I got:

ORA-00942: table or view does not exist
00942. 00000 -  "table or view does not exist"
*Cause:    
*Action:
Error at Line: 20 Column: 6
1
What is pricelist in that query - is that just supposed to be price_table?Alex Poole

1 Answers

1
votes

You have just used the wrong table name; your table is price_table, not pricelist:

SELECT pno, s.COLUMN_VALUE prices
from price_table p,TABLE(p.prices) s
/

       PNO     PRICES
---------- ----------
         1          2
         1          3
         1          4
         2          2
         2          3
         2          4
         3          2
         3          3
         3          4