Sorry for the length of this post. This is an issue I've been investigating for quite a long time, I hope that this will help the developers to resolve the issue.
Es. 1 – date works
Code: Select all
Create type type1 as object(
a_id1 number,
a_date1 date,
a_id2 number,
a_date2 date
) not final;
Create table table1 of type1;
Insert into table1 values (1,to_date( '2012','yyyy'),2,to_date( '2011','yyyy'));
Select value(x) from table1 x; --works
Drop table table1;
Drop type type1;
Code: Select all
Create type type1 as object(
a_id1 number,
a_date1 date
) not final;
Create type type2 under type1(
a_id2 number,
a_date2 date
) not final;
Create table table2 of type2;
Insert into table2 values (1,to_date( '2012','yyyy'),2,to_date( '2011','yyyy'));
Select * from table2 x; -- ok
Select value(x) from table2 x; -- Invalid argument to date encode
Drop table table2;
Drop type type2;
Drop type type1;
Code: Select all
Create type type1 as object(
a_id1 number,
a_date1 timestamp
) not final;
Create type type2 under type1(
a_id2 number,
a_date2 timestamp
) not final;
Create table table2 of type2;
Insert into table2 values (1,systimestamp, 2, systimestamp)
Select value(x) from table2 x; -- it works!
Drop table table2;
Drop type type2;
Drop type type1;
Code: Select all
Create type type1 as object(
a_id1 number(18)
) not final;
Create type type2 under type1(
a_id2 number(18),
a_id3 number(18),
a_date1 timestamp,
a_date2 timestamp,
a_id4 number(18)
) not final;
Create type type3 under type2(
a_id5 number(18)
) not final;
Create table table3 of type3;
Insert into table3 values (1, 2, 3, systimestamp,systimestamp, 4, 5)
Select value(x) from table3 x; -- Numeric Overflow on 2,3: got -1,0E126 -1,0E126
Drop table table3;
drop type type3;
Drop type type2;
Drop type type1;
Code: Select all
Create type type1 as object(
a_id1 number(18)
) not final;
Create type type2 under type1(
a_id2 number(18),
a_id3 number(18),
a_id4 number(18),
a_date1 timestamp,
a_date2 timestamp
) not final;
Create type type3 under type2(
a_id5 number(18)
) not final;
Create table table3 of type3;
Insert into table3 values (1, 2, 3, 4, systimestamp, systimestamp, 5)
Select value(x) from table3 x; -- OCI_INVALID_HANDLE
Drop table table3;
drop type type3;
Drop type type2;
Drop type type1;
Code: Select all
--…after Es6…
alter type type1 add attribute a_date0 timestamp cascade;
Select value(x) from table3 x; -- works