I have a table that has a column defined as varray of a defined type. The production table is way more complicated then the following example.
I am able to select the single columns within the type of the varray. But I would like to update the table with a simple update statement (rather than going through a pl/sql routine).
If this is not possible (and I must go through a pl/sql routine) what is a smart and easy way to code this?
update (select l.id, t.* from my_object_table l, table(l.object_list) t)
set value2 = 'obj 4 upd'
where value1 = 10
ORA-01733: virtual column not allowed here
Here the full example of types etc.
create or replace type my_object
as object(
value1 number,
value2 varchar2(10),
value3 number);
create or replace type my_object_varray as varray(100000000) of my_object;
create table my_object_table (id number not null, object_list my_object_varray);
insert into my_object_table
values (1, my_object_varray (
my_object(1,'object 1',10),
my_object(2,'object 2',20),
my_object(3,'object 3',30)
)
);
insert into my_object_table
values (2, my_object_varray (
my_object(10,'object 4',10),
my_object(20,'object 5',20),
my_object(30,'object 6',30)
)
);
select l.id, t.* from my_object_table l, table(l.object_list) t;
Type created.
Type created.
Table created.
1 row created.
1 row created.
ID VALUE1 VALUE2 VALUE3
---------- ---------- ---------- ----------
1 1 object 1 10
1 2 object 2 20
1 3 object 3 30
2 10 object 4 10
2 20 object 5 20
2 30 object 6 30
6 rows selected.